}

)

■ }

}

var myResult = myDialog.show(); if(myResult == true)(

var myTabType = myTabButtons.selectedButton; var myTabLeader = myTabLeaderField.editContents; myDialog.destroy();

myAddTabStop(myTabType, myTabLeader);

}

elsef

myDialog.destroy();

)

// Добавление табулятора

function myAddTabStop(myTabType, myLeader)(

var myParagraphs, myTabPosition, myTabAlignment, myParagraph; switch(myTabType){ case 0:

myParagraphs = app.selection[0].paragraphs; for(i =0; i < myParagraphs.length; i ++){ myParagraph = myParagraphs[i]; myTabPosition = 4>

myParagraph.insertionPoints[0].parentTextFrames[0]. 4> textFramePreferences.textColumnFixedWidth; myTabAlignment = TabStopAlignment.rightAlign; myParagraph.tabStops.add((alignment:myTabAlignment, 4> leader-.myLeader, position:myTabPosition}) ;

}

break; case 1:

mylnsertionPoint = app.selection[0].insertionPoints[0]; myTabPosition = mylnsertionPoint.horizontalOffset - 4> myFindColumnEdge(mylnsertionPoint); myTabAlignment = TabStopAlignment.leftAlign; mylnsertionPoint.paragraphs[0].tabStops.add((alignment: myTabAlignment, leader:myLeader, position:myTabPosition}) break; case 2:

myParagraphs = app.selection[0].paragraphs; forfi = 0; i < myParagraphs.length; i ++){ myParagraph = myParagraphs[i];

myTabPosition = myparagraph.leftlndent; myTabAlignment = TabStopAlignment.leftAlign; myparagraph. tabStops . add ((alignment .-myTabAlignment, 4j> leader:myLeader, position:myTabPosition});

}

break; case 3:

myParagraphs = app.selection[0].paragraphs;

mylnsertionPoint = app.selection[0].insertionPoints[0];

myTabPosition = mylnsertionPoint.horizontalOffset -myFindColumnEdge(mylnsertionPoint);

myTabAlignment = TabStopAlignment.leftAlign;

for(i = 0; i < myParagraphs.length; i ++)( myparagraph = myParagraphs[i]; myparagraph.leftlndent = myTabPosition; myParagraph.firstLinelndent = -myTabPosition; myparagraph.tabStops.add((alignment:myTabAlignment, leader:myLeader, position:myTabPosition});

}

break;

}

}

// Определение положения левого края колонки function myFindColumnEdge(mylnsertionPoint)(

var i, myLeftlnset, myRightlnset, myXl, myX2, myColumnEdge; var myPagePosition = mylnsertionPoint.horizontalOffset; var myTextFrame = mylnsertionPoint.parentTextFrames[0]; var myColumnWidth =

myTextFrame.textFramePreferences.textColumnFixedWidth; var myGutterWidth = myTextFrame.textFramePreferences.textColumnGutter; var myTextFrameWidth = myTextFrame.geometricBounds[3] myTextFrame.geometricBounds[1]; var myXOffset = myPagePosition - myTextFrame.geometricBounds[1]; var myArray = new Array; for (i = 0; i < myTextFrame.textFramePreferences.textColumnCount; i ++)( II Если колонка всего одна if (i = 0) (

// Если заданы отступы от краев фрейма

if(myTextFrame.textFramePreferences.insetSpacing.length == 4){ myLeftlnset = myTextFrame.textFramePreferences.insetSpacing[1]; myRightlnset = myTextFrame.textFramePreferences.insetSpacing[3];

else(

11 Если отступы не заданы, длина массива insetSpacing=l myLeftlnset = myTextFrame.textFramePreferences.insetSpacing[0]; myRightlnset = myTextFrame.textFramePreferences.insetSpacing[0];


⇐ вернуться назад | | далее ⇒