diff options
Diffstat (limited to 'sw/source')
64 files changed, 6164 insertions, 1357 deletions
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index d2b60c080029..7af17f8eb325 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -24,6 +24,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <cmdid.h> #include <hintids.hxx> #include <vcl/virdev.hxx> #include <svx/svdmodel.hxx> @@ -34,6 +35,8 @@ #include <tools/urlobj.hxx> #include <sfx2/docfile.hxx> #include <sfx2/printer.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> #include <unotools/localedatawrapper.hxx> #include <com/sun/star/document/PrinterIndependentLayout.hpp> #include <fmtfsize.hxx> @@ -424,6 +427,18 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged ) { GetIDocumentUndoRedo().DelAllUndoObj(); } + + SfxBindings* pBindings = + ( GetDocShell() && GetDocShell()->GetDispatcher() ) ? GetDocShell()->GetDispatcher()->GetBindings() : 0; + if ( pBindings ) + { + pBindings->Invalidate( SID_ATTR_PAGE_COLUMN ); + pBindings->Invalidate( SID_ATTR_PAGE ); + pBindings->Invalidate( SID_ATTR_PAGE_SIZE ); + pBindings->Invalidate( SID_ATTR_PAGE_ULSPACE ); + pBindings->Invalidate( SID_ATTR_PAGE_LRSPACE ); + } + } /************************************************************************* diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx index 32f50ee4471d..c00b9c74887e 100644 --- a/sw/source/core/draw/drawdoc.cxx +++ b/sw/source/core/draw/drawdoc.cxx @@ -76,8 +76,8 @@ SwDrawDocument::SwDrawDocument( SwDoc* pD ) : SetObjectShell( pDocSh ); SvxColorTableItem* pColItem = ( SvxColorTableItem* ) ( pDocSh->GetItem( SID_COLOR_TABLE ) ); - XColorTable *pXCol = pColItem ? pColItem->GetColorTable() : - XColorTable::GetStdColorTable(); + XColorList *pXCol = pColItem ? pColItem->GetColorTable() : + XColorList::GetStdColorList(); SetColorTable( pXCol ); if ( !pColItem ) @@ -92,7 +92,7 @@ SwDrawDocument::SwDrawDocument( SwDoc* pD ) : SetObjectShell( pDocSh ); } else - SetColorTable( XColorTable::GetStdColorTable() ); + SetColorTable( XColorList::GetStdColorList() ); // copy all the default values to the SdrModel SfxItemPool* pSdrPool = pD->GetAttrPool().GetSecondaryPool(); diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index 0938de3d6fc6..743834791f73 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -164,7 +164,88 @@ sal_Bool SwEditShell::NoNum() return bRet; } // Loeschen, Splitten der Aufzaehlungsliste +sal_Bool SwEditShell::SelectionHasNumber() const +{ + sal_Bool bResult = HasNumber(); + const SwTxtNode * pTxtNd = + GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode(); + if (!bResult && pTxtNd && pTxtNd->Len()==0 && !pTxtNd->GetNumRule()) { + SwPamRanges aRangeArr( *GetCrsr() ); + SwPaM aPam( *GetCrsr()->GetPoint() ); + for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n ) + { + aRangeArr.SetPam( n, aPam ); + { + sal_uInt32 nStt = aPam.GetPoint()->nNode.GetIndex(), + nEnd = aPam.GetMark()->nNode.GetIndex(); + if( nStt > nEnd ) + { + sal_uInt32 nTmp = nStt; nStt = nEnd; nEnd = nTmp; + } + for (sal_uInt32 nPos = nStt; nPos<=nEnd; nPos++) { + SwTxtNode * pTxtNd = pDoc->GetNodes()[nPos]->GetTxtNode(); + if (pTxtNd && pTxtNd->Len()!=0) + { + bResult = pTxtNd->HasNumber(); + + // --> OD 2005-10-26 #b6340308# + // special case: outline numbered, not counted paragraph + if ( bResult && + pTxtNd->GetNumRule() == GetDoc()->GetOutlineNumRule() && + !pTxtNd->IsCountedInList() ) + { + bResult = sal_False; + } + if (bResult==sal_False) { + break; + } + // <-- + } + } + } + } + + } + + return bResult; +} +//Sym3_879 add a new function to determine number on/off status +sal_Bool SwEditShell::SelectionHasBullet() const +{ + sal_Bool bResult = HasBullet(); + const SwTxtNode * pTxtNd = + GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode(); + if (!bResult && pTxtNd && pTxtNd->Len()==0 && !pTxtNd->GetNumRule()) { + SwPamRanges aRangeArr( *GetCrsr() ); + SwPaM aPam( *GetCrsr()->GetPoint() ); + for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n ) + { + aRangeArr.SetPam( n, aPam ); + { + sal_uInt32 nStt = aPam.GetPoint()->nNode.GetIndex(), + nEnd = aPam.GetMark()->nNode.GetIndex(); + if( nStt > nEnd ) + { + sal_uInt32 nTmp = nStt; nStt = nEnd; nEnd = nTmp; + } + for (sal_uInt32 nPos = nStt; nPos<=nEnd; nPos++) { + SwTxtNode * pTxtNd = pDoc->GetNodes()[nPos]->GetTxtNode(); + if (pTxtNd && pTxtNd->Len()!=0) + { + bResult = pTxtNd->HasBullet(); + if (bResult==sal_False) { + break; + } + } + } + } + } + + } + + return bResult; +} // -> #i29560# sal_Bool SwEditShell::HasNumber() const { diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 5c9b7b5ec49e..25ac58f4c0c6 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -2486,7 +2486,7 @@ sal_uInt8 SwFEShell::IsSelObjProtected( sal_uInt16 eType ) const { // TODO/LATER: use correct aspect const bool bNeverResize = (embed::EmbedMisc::EMBED_NEVERRESIZE & xObj->getStatus( embed::Aspects::MSOLE_CONTENT )); - if ( (FLYPROTECT_CONTENT & eType) && bNeverResize ) + if ( ( (FLYPROTECT_CONTENT & eType) || (FLYPROTECT_SIZE & eType) ) && bNeverResize ) { nChk |= FLYPROTECT_SIZE; nChk |= FLYPROTECT_FIXED; diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 4a85efb51c9b..7ebd8f976d4f 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -1019,7 +1019,7 @@ void SwDocShell::Execute(SfxRequest& rReq) case SID_GET_COLORTABLE: { SvxColorTableItem* pColItem = (SvxColorTableItem*)GetItem(SID_COLOR_TABLE); - XColorTable* pTable = pColItem->GetColorTable(); + XColorList* pTable = pColItem->GetColorTable(); rReq.SetReturnValue(OfaPtrItem(SID_GET_COLORTABLE, pTable)); } break; diff --git a/sw/source/ui/app/docshdrw.cxx b/sw/source/ui/app/docshdrw.cxx index bcd76273aad5..96e2041b4727 100644 --- a/sw/source/ui/app/docshdrw.cxx +++ b/sw/source/ui/app/docshdrw.cxx @@ -73,7 +73,7 @@ void SwDocShell::InitDraw() rOutliner.SetHyphenator( xHyphenator ); } else - PutItem( SvxColorTableItem( XColorTable::GetStdColorTable(), SID_COLOR_TABLE )); + PutItem( SvxColorTableItem( XColorList::GetStdColorList(), SID_COLOR_TABLE )); } diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index e32356194401..b121dfdc0a29 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -439,9 +439,9 @@ SwDocShell::SwDocShell( SwDoc *pD, SfxObjectCreateMode eMode ): // wird nur die DocInfo fuer den Explorer gelesen, ist das Item nicht da if(pColItem) { - XColorTable* pTable = pColItem->GetColorTable(); + XColorList* pTable = pColItem->GetColorTable(); // wurde eine neue Table angelegt, muss sie auch geloescht werden. - if((void*)pTable != (void*)(XColorTable::GetStdColorTable()) ) + if((void*)pTable != (void*)(XColorList::GetStdColorList()) ) delete pTable; } diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx index 93f0b3f50577..651a77270e2a 100644 --- a/sw/source/ui/app/docst.cxx +++ b/sw/source/ui/app/docst.cxx @@ -283,7 +283,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILY, sal_False, &pItem )) { - sal_uInt16 nFamily = ((const SfxUInt16Item*)pItem)->GetValue(); + const sal_uInt16 nFamily = ((const SfxUInt16Item*)pItem)->GetValue(); String sName; sal_uInt16 nMask = 0; @@ -298,7 +298,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) sal_False, &pItem )) sParent = ((const SfxStringItem*)pItem)->GetValue(); - nRet = Edit( sName, sParent, nFamily, nMask, sal_True, sal_False, 0, rReq.IsAPI() ); + nRet = Edit( sName, sParent, nFamily, nMask, sal_True, 0, 0, rReq.IsAPI() ); } break; @@ -458,7 +458,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) switch(nSlot) { case SID_STYLE_EDIT: - nRet = Edit(aParam, aEmptyStr, nFamily, nMask, sal_False, sal_False, pActShell ); + nRet = Edit(aParam, aEmptyStr, nFamily, nMask, sal_False, 0, pActShell ); break; case SID_STYLE_DELETE: nRet = Delete(aParam, nFamily); @@ -509,9 +509,15 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) --------------------------------------------------------------------*/ -sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uInt16 nFamily, sal_uInt16 nMask, - sal_Bool bNew, sal_Bool bColumn, SwWrtShell* pActShell, - sal_Bool bBasic ) +sal_uInt16 SwDocShell::Edit( + const String &rName, + const String &rParent, + const sal_uInt16 nFamily, + sal_uInt16 nMask, + const sal_Bool bNew, + const sal_uInt16 nSlot, + SwWrtShell* pActShell, + const sal_Bool bBasic ) { ASSERT(GetWrtShell(), "Keine Shell, keine Styles"); SfxStyleSheetBase *pStyle = 0; @@ -677,7 +683,7 @@ sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uIn SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialogdiet fail!"); SfxAbstractTabDialog* pDlg = pFact->CreateTemplateDialog( DLG_TEMPLATE_BASE, - 0, *(xTmp.get()), nFamily, bColumn, + 0, *(xTmp.get()), nFamily, nSlot, pActShell ? pActShell : pWrtShell, bNew); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if(RET_OK == pDlg->Execute()) @@ -1286,9 +1292,12 @@ void SwDocShell::_LoadStyles( SfxObjectShell& rSource, sal_Bool bPreserveCurrent } -void SwDocShell::FormatPage( const String& rPage, sal_Bool bColumn, SwWrtShell* pActShell ) +void SwDocShell::FormatPage( + const String& rPage, + const sal_uInt16 nSlot, + SwWrtShell& rActShell ) { - Edit( rPage, aEmptyStr, SFX_STYLE_FAMILY_PAGE, 0, sal_False, bColumn, pActShell); + Edit( rPage, aEmptyStr, SFX_STYLE_FAMILY_PAGE, 0, sal_False, nSlot, &rActShell); } Bitmap SwDocShell::GetStyleFamilyBitmap( SfxStyleFamily eFamily, BmpColorMode eColorMode ) diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src index ff1cd46f9786..0c61e6de3a47 100644 --- a/sw/source/ui/app/mn.src +++ b/sw/source/ui/app/mn.src @@ -430,20 +430,20 @@ location: <project>/uiconfig/[swriter|sweb|sglobal]/menubar/menubar.xml SEPARATOR ; \ MenuItem\ {\ - Identifier = FN_TABLE_VERT_NONE ; \ - HelpId = CMD_FN_TABLE_VERT_NONE ; \ + Identifier = SID_TABLE_VERT_NONE ; \ + HelpId = CMD_SID_TABLE_VERT_NONE ; \ Text [ en-US ] = "~Top" ; \ };\ MenuItem\ {\ - Identifier = FN_TABLE_VERT_CENTER ; \ - HelpId = CMD_FN_TABLE_VERT_CENTER ; \ + Identifier = SID_TABLE_VERT_CENTER ; \ + HelpId = CMD_SID_TABLE_VERT_CENTER ; \ Text [ en-US ] = "C~enter" ; \ };\ MenuItem\ {\ - Identifier = FN_TABLE_VERT_BOTTOM ; \ - HelpId = CMD_FN_TABLE_VERT_BOTTOM ; \ + Identifier = SID_TABLE_VERT_BOTTOM ; \ + HelpId = CMD_SID_TABLE_VERT_BOTTOM ; \ Text [ en-US ] = "~Bottom" ; \ };\ SEPARATOR ; \ diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx index 2d61f849945d..364724815559 100644 --- a/sw/source/ui/app/swmodule.cxx +++ b/sw/source/ui/app/swmodule.cxx @@ -134,6 +134,7 @@ #include <mailmergechildwindow.hxx> #include <modcfg.hxx> #include <fontcfg.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include <sfx2/taskpane.hxx> #include <sfx2/evntconf.hxx> #include <sfx2/appuno.hxx> @@ -464,7 +465,8 @@ void SwDLL::RegisterControls() ::avmedia::MediaPlayer::RegisterChildWindow(0, pMod); SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod); - ::sfx2::TaskPaneWrapper::RegisterChildWindow( sal_False, pMod ); + ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(NULL, pMod); + ::sfx2::TaskPaneWrapper::RegisterChildWindow(NULL, pMod); } diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index a7ffa61312c1..0f96f07a12ec 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -2133,7 +2133,7 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet& ) aDeletedColorLB.InsertEntry(sAuthor); aChangedColorLB.InsertEntry(sAuthor); - XColorTable* pColorTbl = XColorTable::GetStdColorTable(); + XColorList* pColorTbl = XColorList::GetStdColorList(); sal_uInt16 i; for( i = 0; i < pColorTbl->Count(); ++i ) { diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index a65159986042..6394418a84c6 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -1295,7 +1295,7 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateTemplateDialog( int nR Window* pParent, SfxStyleSheetBase& rBase, sal_uInt16 nRegion, - sal_Bool bColumn, + const sal_uInt16 nSlot, SwWrtShell* pActShell, sal_Bool bNew ) //add for SwTemplateDlg { @@ -1303,7 +1303,7 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateTemplateDialog( int nR switch ( nResId ) { case DLG_TEMPLATE_BASE : - pDlg = new SwTemplateDlg( pParent, rBase, nRegion, bColumn, pActShell, bNew ); + pDlg = new SwTemplateDlg( pParent, rBase, nRegion, nSlot, pActShell, bNew ); break; default: break; diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 87bf5594eabd..1183c0b7f28c 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -502,7 +502,7 @@ public: Window* pParent, SfxStyleSheetBase& rBase, sal_uInt16 nRegion, - sal_Bool bColumn = sal_False, + const sal_uInt16 nSlot = 0, SwWrtShell* pActShell = 0, sal_Bool bNew = sal_False ); //add for SwTemplateDlg virtual AbstractGlossaryDlg* CreateGlossaryDlg( int nResId, diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index 3bc4fda74f9d..5a59d906e77f 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -106,7 +106,7 @@ extern SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell(); SwTemplateDlg::SwTemplateDlg(Window* pParent, SfxStyleSheetBase& rBase, sal_uInt16 nRegion, - sal_Bool bColumn, + const sal_uInt16 nSlot, SwWrtShell* pActShell, sal_Bool bNew ) : SfxStyleDialog( pParent, @@ -260,15 +260,6 @@ SwTemplateDlg::SwTemplateDlg(Window* pParent, AddTabPage( TP_MACRO_ASSIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0); - // Auskommentiert wegen Bug #45776 (per default keine Breite&Groesse in Rahmenvorlagen) -/* SwFmtFrmSize aSize( (const SwFmtFrmSize&)rBase. - GetItemSet().Get(RES_FRM_SIZE)); - if( !aSize.GetWidth() ) - { - aSize.SetWidth( DFLT_WIDTH ); - aSize.SetHeight( DFLT_HEIGHT ); - rBase.GetItemSet().Put( aSize ); - }*/ break; } // Seitenvorlagen @@ -283,8 +274,14 @@ SwTemplateDlg::SwTemplateDlg(Window* pParent, AddTabPage(TP_FOOTER_PAGE, String(SW_RES(STR_PAGE_FOOTER)), SvxFooterPage::Create, SvxFooterPage::GetRanges ); - if(bColumn) + if ( nSlot == FN_FORMAT_PAGE_COLUMN_DLG ) + { SetCurPageId(TP_COLUMN); + } + else if ( nSlot == FN_FORMAT_PAGE_SETTING_DLG ) + { + SetCurPageId(TP_PAGE_STD); + } DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!"); DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!"); diff --git a/sw/source/ui/inc/drwbassh.hxx b/sw/source/ui/inc/drwbassh.hxx index 9bd33bb05101..fdb9c457676e 100644 --- a/sw/source/ui/inc/drwbassh.hxx +++ b/sw/source/ui/inc/drwbassh.hxx @@ -49,6 +49,7 @@ public: void Execute(SfxRequest &); void GetState(SfxItemSet &); + void GetDrawAttrStateForIFBX( SfxItemSet& rSet ); void DisableState(SfxItemSet &rSet) { Disable(rSet);} sal_Bool Disable(SfxItemSet& rSet, sal_uInt16 nWhich = 0); diff --git a/sw/source/ui/inc/drwtxtsh.hxx b/sw/source/ui/inc/drwtxtsh.hxx index 8d0c68d60ca6..6412f524a749 100644 --- a/sw/source/ui/inc/drwtxtsh.hxx +++ b/sw/source/ui/inc/drwtxtsh.hxx @@ -60,6 +60,7 @@ public: void Execute(SfxRequest &); void ExecDraw(SfxRequest &); + void GetStatePropPanelAttr(SfxItemSet &); void GetState(SfxItemSet &); void GetDrawTxtCtrlState(SfxItemSet&); diff --git a/sw/source/ui/inc/textsh.hxx b/sw/source/ui/inc/textsh.hxx index cee32496f375..f91b8490633c 100644 --- a/sw/source/ui/inc/textsh.hxx +++ b/sw/source/ui/inc/textsh.hxx @@ -64,6 +64,7 @@ public: void ExecMoveLingu(SfxRequest &); void ExecMoveMisc(SfxRequest &); void ExecField(SfxRequest &rReq); + void ExecSetNumber(SfxRequest &); void StateField(SfxItemSet &); void ExecIdx(SfxRequest &); void GetIdxState(SfxItemSet &); diff --git a/sw/source/ui/inc/tmpdlg.hxx b/sw/source/ui/inc/tmpdlg.hxx index 693a39578d53..22c2e4d1cf9d 100644 --- a/sw/source/ui/inc/tmpdlg.hxx +++ b/sw/source/ui/inc/tmpdlg.hxx @@ -37,18 +37,21 @@ class SwTemplateDlg: public SfxStyleDialog sal_uInt16 nType; sal_uInt16 nHtmlMode; - SwWrtShell* pWrtShell; + SwWrtShell* pWrtShell; sal_Bool bNewStyle; DECL_LINK( NumOptionsHdl, PushButton* ); public: + // @param nSlot + // Identifies optional Slot by which the creation of the Template (Style) dialog is triggered. + // Currently used, if nRegion == SFX_STYLE_FAMILY_PAGE in order to activate certain dialog pane SwTemplateDlg( Window* pParent, SfxStyleSheetBase& rBase, - sal_uInt16 nRegion, - sal_Bool bColumn = sal_False, + sal_uInt16 nRegion, + const sal_uInt16 nSlot = 0, SwWrtShell* pActShell = 0, - sal_Bool bNew = sal_False ); + sal_Bool bNew = sal_False ); ~SwTemplateDlg(); const SfxItemSet* GetRefreshedSet(); diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index 3172fc5fafbc..5fb6f931d114 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -143,7 +143,7 @@ SwTextGridPage::SwTextGridPage(Window *pParent, const SfxItemSet &rSet) : aDisplayCB.SetClickHdl(LINK(this, SwTextGridPage, DisplayGridHdl)); - XColorTable* pColorTbl = XColorTable::GetStdColorTable(); + XColorList* pColorTbl = XColorList::GetStdColorList(); aColorLB.InsertAutomaticEntry(); for( sal_uInt16 i = 0; i < pColorTbl->Count(); ++i ) { diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index d9c8a247bd70..ba175337caa8 100644 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -40,6 +40,8 @@ #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> #include <editeng/spltitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> #include <editeng/orphitem.hxx> #include <editeng/brkitem.hxx> #include <editeng/widwitem.hxx> @@ -105,6 +107,7 @@ #include <svx/dialogs.hrc> #include <svx/svxids.hrc> +#include <sfx2/sidebar/EnumContext.hxx> #include <svl/itempool.hxx> #include <editeng/outliner.hxx> #include <editeng/editeng.hxx> @@ -151,6 +154,7 @@ SwAnnotationShell::SwAnnotationShell( SwView& r ) { SwWrtShell &rSh = rView.GetWrtShell(); SetPool(rSh.GetAttrPool().GetSecondaryPool()); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Annotation)); } SwAnnotationShell::~SwAnnotationShell() @@ -186,6 +190,35 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) sal_uInt16 nEEWhich = 0; switch (nSlot) { + case SID_ATTR_PARA_LRSPACE: + { + SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq. + GetArgs()->Get(nSlot)); + aParaMargin.SetWhich( EE_PARA_LRSPACE ); + + aNewAttr.Put(aParaMargin); + rReq.Done(); + break; + } + case SID_ATTR_PARA_LINESPACE: + { + SvxLineSpacingItem aParaMargin = (const SvxLineSpacingItem&)pNewAttrs->Get( + GetPool().GetWhich(nSlot)); + aParaMargin.SetWhich( EE_PARA_SBL ); + + aNewAttr.Put(aParaMargin); + rReq.Done(); + break; + } + case SID_ATTR_PARA_ULSPACE: + { + SvxULSpaceItem aULSpace = (const SvxULSpaceItem&)pNewAttrs->Get( + GetPool().GetWhich(nSlot)); + aULSpace.SetWhich( EE_PARA_ULSPACE ); + aNewAttr.Put( aULSpace ); + rReq.Done(); + } + break; case SID_ATTR_CHAR_FONT: case SID_ATTR_CHAR_FONTHEIGHT: case SID_ATTR_CHAR_WEIGHT: @@ -203,8 +236,19 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break; case SID_ATTR_CHAR_UNDERLINE: { - FontUnderline eFU = ((const SvxUnderlineItem&)aEditAttr.Get(EE_CHAR_UNDERLINE)).GetLineStyle(); - aNewAttr.Put(SvxUnderlineItem(eFU == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE)); + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxUnderlineItem, SID_ATTR_CHAR_UNDERLINE , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + else + { + FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr.Get( EE_CHAR_UNDERLINE ) ).GetLineStyle(); + aNewAttr.Put( SvxUnderlineItem( eFU != UNDERLINE_NONE ?UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE ) ); + } + } break; } case SID_ATTR_CHAR_OVERLINE: @@ -426,6 +470,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) delete pDialog; } break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: { const SfxItemSet* pArgs = rReq.GetArgs(); @@ -450,6 +495,10 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( rView.GetWindow(), rView, aDlgAttr, DLG_CHAR,0, sal_True ); DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 + if (nSlot == SID_CHAR_DLG_EFFECT) + { + pDlg->SetCurPageId(TP_CHAR_EXT); + } sal_uInt16 nRet = pDlg->Execute(); if(RET_OK == nRet ) { @@ -592,6 +641,44 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich ); switch( nSlotId ) { + case SID_ATTR_PARA_LRSPACE: + { + SfxItemState eState = aEditAttr.GetItemState( EE_PARA_LRSPACE ); + if( eState >= SFX_ITEM_DEFAULT ) + { + SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE ) ); + aLR.SetWhich(SID_ATTR_PARA_LRSPACE); + rSet.Put(aLR); + } + else + rSet.InvalidateItem(nSlotId); + } + break; + case SID_ATTR_PARA_LINESPACE: + { + SfxItemState eState = aEditAttr.GetItemState( EE_PARA_SBL ); + if( eState >= SFX_ITEM_DEFAULT ) + { + SvxLineSpacingItem aLR = ( (const SvxLineSpacingItem&) aEditAttr.Get( EE_PARA_SBL ) ); + rSet.Put(aLR); + } + else + rSet.InvalidateItem(nSlotId); + } + break; + case SID_ATTR_PARA_ULSPACE: + { + SfxItemState eState = aEditAttr.GetItemState( EE_PARA_ULSPACE ); + if( eState >= SFX_ITEM_DEFAULT ) + { + SvxULSpaceItem aULSpace = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE ); + aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE); + rSet.Put(aULSpace); + } + else + rSet.InvalidateItem(nSlotId); + } + break; case SID_ATTR_CHAR_FONT: case SID_ATTR_CHAR_FONTHEIGHT: case SID_ATTR_CHAR_WEIGHT: @@ -622,6 +709,8 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW;break; case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break; case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break; + case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT;break; + case SID_ATTR_CHAR_KERNING: nEEWhich = EE_CHAR_KERNING;break; case FN_SET_SUPER_SCRIPT: case FN_SET_SUB_SCRIPT: { @@ -763,7 +852,17 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) } if(nEEWhich) + { rSet.Put(aEditAttr.Get(nEEWhich, sal_True), nWhich); + if(nEEWhich == EE_CHAR_KERNING) + { + SfxItemState eState = aEditAttr.GetItemState( EE_CHAR_KERNING, sal_True ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_CHAR_KERNING); + } + } + } if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED) rSet.DisableItem( nWhich ); diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index 713b22370ae8..8911882c124c 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -2452,8 +2452,9 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) switch ( nSlot ) { - case FN_FORMAT_PAGE_COLUMN_DLG: case FN_FORMAT_PAGE_DLG: + case FN_FORMAT_PAGE_COLUMN_DLG: + case FN_FORMAT_PAGE_SETTING_DLG: { if( !bBackground ) { @@ -2462,9 +2463,10 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) //temp. View, weil die Shell nach dem Dialog nicht mehr gueltig sein muss //z.B. Kopfzeile ausschalten SwView& rTempView = GetView(); - rTempView.GetDocShell()->FormatPage(rPageDesc.GetName(), - nSlot == FN_FORMAT_PAGE_COLUMN_DLG, - &rSh ); + rTempView.GetDocShell()->FormatPage( + rPageDesc.GetName(), + nSlot, + rSh ); rTempView.InvalidateRulerPos(); } } diff --git a/sw/source/ui/shells/beziersh.cxx b/sw/source/ui/shells/beziersh.cxx index b4f639232a3b..332e5e51ece7 100644 --- a/sw/source/ui/shells/beziersh.cxx +++ b/sw/source/ui/shells/beziersh.cxx @@ -31,6 +31,7 @@ #include <svl/eitem.hxx> #include <svl/whiter.hxx> #include <svx/svdopath.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <sfx2/request.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/objface.hxx> @@ -73,6 +74,8 @@ SwBezierShell::SwBezierShell(SwView &_rView): SwWrtShell *pSh = &GetShell(); SdrView* pSdrView = pSh->GetDrawView(); pSdrView->SetEliminatePolyPointLimitAngle(1500L); + + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Draw)); } /*-------------------------------------------------------------------- @@ -347,6 +350,3 @@ void SwBezierShell::GetState(SfxItemSet &rSet) nWhich = aIter.NextWhich(); } } - - - diff --git a/sw/source/ui/shells/drawdlg.cxx b/sw/source/ui/shells/drawdlg.cxx index fa190755b778..26cd85732705 100644 --- a/sw/source/ui/shells/drawdlg.cxx +++ b/sw/source/ui/shells/drawdlg.cxx @@ -108,7 +108,7 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) DBG_ASSERT(pDlg, "Dialogdiet fail!"); const SvxColorTableItem* pColorItem = (const SvxColorTableItem*) GetView().GetDocShell()->GetItem(SID_COLOR_TABLE); - if(pColorItem->GetColorTable() == XColorTable::GetStdColorTable()) + if(pColorItem->GetColorTable() == XColorList::GetStdColorList()) pDlg->DontDeleteColorTable(); if (pDlg->Execute() == RET_OK) { @@ -121,12 +121,18 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) static sal_uInt16 __READONLY_DATA aInval[] = { - SID_ATTR_FILL_STYLE, SID_ATTR_FILL_COLOR, 0 + SID_ATTR_FILL_STYLE, + SID_ATTR_FILL_COLOR, + SID_ATTR_FILL_TRANSPARENCE, + SID_ATTR_FILL_FLOATTRANSPARENCE, + 0 }; SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings(); rBnd.Invalidate(aInval); rBnd.Update(SID_ATTR_FILL_STYLE); rBnd.Update(SID_ATTR_FILL_COLOR); + rBnd.Update(SID_ATTR_FILL_TRANSPARENCE); + rBnd.Update(SID_ATTR_FILL_FLOATTRANSPARENCE); } delete pDlg; } @@ -160,8 +166,16 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) static sal_uInt16 __READONLY_DATA aInval[] = { - SID_ATTR_LINE_STYLE, SID_ATTR_LINE_WIDTH, - SID_ATTR_LINE_COLOR, 0 + SID_ATTR_LINE_STYLE, // ( SID_SVX_START + 169 ) + SID_ATTR_LINE_DASH, // ( SID_SVX_START + 170 ) + SID_ATTR_LINE_WIDTH, // ( SID_SVX_START + 171 ) + SID_ATTR_LINE_COLOR, // ( SID_SVX_START + 172 ) + SID_ATTR_LINE_START, // ( SID_SVX_START + 173 ) + SID_ATTR_LINE_END, // ( SID_SVX_START + 174 ) + SID_ATTR_LINE_TRANSPARENCE, // (SID_SVX_START+1107) + SID_ATTR_LINE_JOINT, // (SID_SVX_START+1110) + SID_ATTR_LINE_CAP, // (SID_SVX_START+1111) + 0 }; GetView().GetViewFrame()->GetBindings().Invalidate(aInval); @@ -214,12 +228,17 @@ void SwDrawShell::ExecDrawAttrArgs(SfxRequest& rReq) case SID_ATTR_FILL_GRADIENT: case SID_ATTR_FILL_HATCH: case SID_ATTR_FILL_BITMAP: + case SID_ATTR_FILL_TRANSPARENCE: + case SID_ATTR_FILL_FLOATTRANSPARENCE: pDis->Execute(SID_ATTRIBUTES_AREA, sal_False); break; case SID_ATTR_LINE_STYLE: case SID_ATTR_LINE_DASH: case SID_ATTR_LINE_WIDTH: case SID_ATTR_LINE_COLOR: + case SID_ATTR_LINE_TRANSPARENCE: + case SID_ATTR_LINE_JOINT: + case SID_ATTR_LINE_CAP: pDis->Execute(SID_ATTRIBUTES_LINE, sal_False); break; } diff --git a/sw/source/ui/shells/drawsh.cxx b/sw/source/ui/shells/drawsh.cxx index 3ab5d2270009..f027bf7e531e 100644 --- a/sw/source/ui/shells/drawsh.cxx +++ b/sw/source/ui/shells/drawsh.cxx @@ -49,6 +49,7 @@ #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <svx/xtable.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/svdoashp.hxx> #include "swundo.hxx" @@ -169,9 +170,11 @@ void SwDrawShell::Execute(SfxRequest &rReq) break; case FN_FLIP_HORZ_GRAFIC: + case SID_FLIP_HORIZONTAL: bMirror = sal_False; /* no break */ case FN_FLIP_VERT_GRAFIC: + case SID_FLIP_VERTICAL: rSh.MirrorSelection( bMirror ); break; @@ -346,11 +349,13 @@ void SwDrawShell::GetState(SfxItemSet& rSet) break; case FN_FLIP_HORZ_GRAFIC: + case SID_FLIP_HORIZONTAL: if ( !pSdrView->IsMirrorAllowed() || bProtected ) rSet.DisableItem( nWhich ); break; case FN_FLIP_VERT_GRAFIC: + case SID_FLIP_VERTICAL: if ( !pSdrView->IsMirrorAllowed() || bProtected ) rSet.DisableItem( nWhich ); break; @@ -384,6 +389,8 @@ SwDrawShell::SwDrawShell(SwView &_rView) : { SetHelpId(SW_DRAWSHELL); SetName(String::CreateFromAscii("Draw")); + + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Draw)); } /************************************************************************* @@ -472,12 +479,8 @@ void SwDrawShell::GetFormTextState(SfxItemSet& rSet) else { if ( pDlg ) - pDlg->SetColorTable(XColorTable::GetStdColorTable()); + pDlg->SetColorTable(XColorList::GetStdColorList()); pDrView->GetAttributes( rSet ); } } - - - - diff --git a/sw/source/ui/shells/drformsh.cxx b/sw/source/ui/shells/drformsh.cxx index 5e73121bf3be..80b6ac857678 100644 --- a/sw/source/ui/shells/drformsh.cxx +++ b/sw/source/ui/shells/drformsh.cxx @@ -35,6 +35,7 @@ #include <sfx2/app.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svl/srchitem.hxx> #include <svx/fmglob.hxx> #include <svx/svdouno.hxx> @@ -262,11 +263,9 @@ SwDrawFormShell::SwDrawFormShell(SwView &_rView) : SetHelpId(SW_DRAWFORMSHELL); GetShell().NoEdit(sal_True); SetName(String::CreateFromAscii("DrawForm")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Form)); } SwDrawFormShell::~SwDrawFormShell() { } - - - diff --git a/sw/source/ui/shells/drwbassh.cxx b/sw/source/ui/shells/drwbassh.cxx index c3cd2c3de007..ead51e7d7b59 100644 --- a/sw/source/ui/shells/drwbassh.cxx +++ b/sw/source/ui/shells/drwbassh.cxx @@ -382,6 +382,10 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) } } + else + { + pSdrView->SetGeoAttrToMarked( *pArgs ); + } } } break; @@ -770,9 +774,19 @@ void SwDrawBaseShell::GetState(SfxItemSet& rSet) } } -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ + +void SwDrawBaseShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet ) +{ + SwWrtShell *pSh = &GetShell(); + SdrView* pSdrView = pSh->GetDrawView(); + const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); + if( rMarkList.GetMark(0) != 0 ) + { + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();//OST_IFBX@WL2 + SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked()); + rSet.Put(aNewAttr,false); + } +} sal_Bool SwDrawBaseShell::Disable(SfxItemSet& rSet, sal_uInt16 nWhich) @@ -990,7 +1004,3 @@ IMPL_LINK(SwDrawBaseShell, ValidatePosition, SvxSwFrameValidation*, pValidation pValidation->nHeight = pValidation->nMaxHeight; return 0; } - - - - diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index b4a713f72e3e..c6795a7f2376 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -34,6 +34,8 @@ #include <tools/shl.hxx> #include <svx/svdview.hxx> #include <editeng/spltitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> #include <editeng/orphitem.hxx> #include <editeng/brkitem.hxx> #include <editeng/widwitem.hxx> @@ -236,6 +238,33 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case SID_ATTR_PARA_ADJUST_BLOCK: aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST)); break; + case SID_ATTR_PARA_LRSPACE: + { + SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq. + GetArgs()->Get(nSlot)); + aParaMargin.SetWhich( EE_PARA_LRSPACE ); + aNewAttr.Put(aParaMargin); + rReq.Done(); + } + break; + case SID_ATTR_PARA_LINESPACE: + { + SvxLineSpacingItem aLineSpace = (const SvxLineSpacingItem&)pNewAttrs->Get( + GetPool().GetWhich(nSlot)); + aLineSpace.SetWhich( EE_PARA_SBL ); + aNewAttr.Put( aLineSpace ); + rReq.Done(); + } + break; + case SID_ATTR_PARA_ULSPACE: + { + SvxULSpaceItem aULSpace = (const SvxULSpaceItem&)pNewAttrs->Get( + GetPool().GetWhich(nSlot)); + aULSpace.SetWhich( EE_PARA_ULSPACE ); + aNewAttr.Put( aULSpace ); + rReq.Done(); + } + break; case SID_ATTR_PARA_LINESPACE_10: { @@ -286,6 +315,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) } break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: case SID_CHAR_DLG_FOR_PARAGRAPH: { @@ -317,6 +347,10 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( pView->GetWindow(), *pView, aDlgAttr, DLG_CHAR,0, sal_True ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); + if (nSlot == SID_CHAR_DLG_EFFECT) + { + pDlg->SetCurPageId(TP_CHAR_EXT); + } sal_uInt16 nRet = pDlg->Execute(); if(RET_OK == nRet ) { @@ -635,6 +669,49 @@ ASK_ADJUST: } break; + case SID_ATTR_PARA_LRSPACE: + { + SfxItemState eState = aEditAttr.GetItemState(EE_PARA_LRSPACE); + if( eState >= SFX_ITEM_DEFAULT ) + { + SvxLRSpaceItem aLR = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE ); + aLR.SetWhich(SID_ATTR_PARA_LRSPACE); + rSet.Put(aLR); + } + else + rSet.InvalidateItem(nSlotId); + nSlotId = 0; + } + break; + case SID_ATTR_PARA_LINESPACE: + { + SfxItemState eState = aEditAttr.GetItemState(EE_PARA_SBL); + if( eState >= SFX_ITEM_DEFAULT ) + { + SvxLineSpacingItem aLR = (const SvxLineSpacingItem&) aEditAttr.Get( EE_PARA_SBL ); + rSet.Put(aLR); + } + else + rSet.InvalidateItem(nSlotId); + nSlotId = 0; + } + break; + case SID_ATTR_PARA_ULSPACE: + { + SfxItemState eState = aEditAttr.GetItemState(EE_PARA_ULSPACE); + if( eState >= SFX_ITEM_DEFAULT ) + { + SvxULSpaceItem aULSpace = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE ); + aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE); + rSet.Put(aULSpace); + } + else + rSet.InvalidateItem(nSlotId); + Invalidate(SID_ATTR_PARA_ULSPACE); + nSlotId = 0; + } + break; + case SID_ATTR_PARA_LINESPACE_10: nLSpace = 100; goto ASK_LINESPACE; case SID_ATTR_PARA_LINESPACE_15: nLSpace = 150; goto ASK_LINESPACE; case SID_ATTR_PARA_LINESPACE_20: nLSpace = 200; goto ASK_LINESPACE; diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index d32e87825f02..0295fd63b35a 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -42,6 +42,7 @@ #include <sfx2/bindings.hxx> #include <svx/fontwork.hxx> #include <sfx2/request.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svl/whiter.hxx> #include <editeng/outliner.hxx> #include <editeng/editstat.hxx> @@ -155,6 +156,7 @@ SwDrawTextShell::SwDrawTextShell(SwView &rV) : rSh.NoEdit(sal_True); SetName(String::CreateFromAscii("ObjectText")); SetHelpId(SW_DRWTXTSHELL); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawText)); } /*-------------------------------------------------------------------- @@ -358,7 +360,7 @@ void SwDrawTextShell::GetFormTextState(SfxItemSet& rSet) else { if ( pDlg ) - pDlg->SetColorTable(XColorTable::GetStdColorTable()); + pDlg->SetColorTable(XColorList::GetStdColorList()); pDrView->GetAttributes( rSet ); } @@ -572,6 +574,28 @@ void SwDrawTextShell::ExecDraw(SfxRequest &rReq) } } break; + case SID_TABLE_VERT_NONE: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_BOTTOM: + { + sal_uInt16 nSId = rReq.GetSlot(); + if (pSdrView->AreObjectsMarked()) + { + SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP; + if (nSId == SID_TABLE_VERT_CENTER) + eTVA = SDRTEXTVERTADJUST_CENTER; + else if (nSId == SID_TABLE_VERT_BOTTOM) + eTVA = SDRTEXTVERTADJUST_BOTTOM; + + SfxItemSet aNewAttr( pSdrView->GetModel()->GetItemPool() ); + pSdrView->GetAttributes( aNewAttr ); + aNewAttr.Put(SdrTextVertAdjustItem(eTVA)); + pSdrView->SetAttributes(aNewAttr); + rReq.Done(); + } + + } + break; default: ASSERT(!this, "unexpected slot-id"); @@ -893,5 +917,53 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) return &pOutliner->GetUndoManager(); } +void SwDrawTextShell::GetStatePropPanelAttr(SfxItemSet &rSet) +{ + SfxWhichIter aIter( rSet ); + sal_uInt16 nWhich = aIter.FirstWhich(); + + SwWrtShell &rSh = GetShell(); + pSdrView = rSh.GetDrawView(); + SfxItemSet aAttrs( pSdrView->GetModel()->GetItemPool() ); + pSdrView->GetAttributes( aAttrs ); + while ( nWhich ) + { + sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich) + ? GetPool().GetSlotId(nWhich) + : nWhich; + switch ( nSlotId ) + { + case SID_TABLE_VERT_NONE: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_BOTTOM: + sal_Bool bContour = sal_False; + SfxItemState eConState = aAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME ); + if( eConState != SFX_ITEM_DONTCARE ) + { + bContour = ( ( const SdrTextContourFrameItem& )aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue(); + } + if (bContour) break; + + SfxItemState eVState = aAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ); + //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ); + + //if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState) + if(SFX_ITEM_DONTCARE != eVState) + { + SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue(); + sal_Bool bSet = nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP|| + nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER || + nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM; + rSet.Put(SfxBoolItem(nSlotId, bSet)); + } + else + { + rSet.Put(SfxBoolItem(nSlotId, sal_False)); + } + break; + } + nWhich = aIter.NextWhich(); + } +} diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx index 83e1be9ce32e..c09610c60950 100644 --- a/sw/source/ui/shells/frmsh.cxx +++ b/sw/source/ui/shells/frmsh.cxx @@ -35,6 +35,8 @@ #include <svl/rectitem.hxx> #include <svl/ptitem.hxx> #include <svl/stritem.hxx> +#include <svl/intitem.hxx> +#include <svl/eitem.hxx> #include <editeng/colritem.hxx> #include <editeng/bolnitem.hxx> #include <editeng/boxitem.hxx> @@ -42,6 +44,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> #include <sfx2/objface.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/hlnkitem.hxx> // --> OD 2009-07-07 #i73249# #include <svx/svdview.hxx> @@ -382,7 +385,38 @@ void SwFrameShell::Execute(SfxRequest &rReq) } } break; + + case SID_ATTR_TRANSFORM: + { + bool bApplyNewSize = false; + + Size aNewSize = aMgr.GetSize(); + if ( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_TRANSFORM_WIDTH, sal_False, &pItem ) ) + { + aNewSize.setWidth( static_cast< const SfxUInt32Item* >(pItem)->GetValue() ); + bApplyNewSize = true; + } + + if ( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_TRANSFORM_HEIGHT, sal_False, &pItem ) ) + { + aNewSize.setHeight( static_cast< const SfxUInt32Item* >(pItem)->GetValue() ); + bApplyNewSize = true; + } + + if ( bApplyNewSize ) + { + aMgr.SetSize( aNewSize ); + } + else + { + bUpdateMgr = sal_False; + } + + } + break; + case FN_FORMAT_FRAME_DLG: + case FN_PROPERTY_WRAP_DLG: { const int nSel = rSh.GetSelectionType(); if (nSel & nsSelectionType::SEL_GRF) @@ -416,10 +450,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName())); if( nSel & nsSelectionType::SEL_OLE ) { - // --> OD 2009-07-13 #i73249# -// aSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, rSh.GetAlternateText())); aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) ); - // <-- } const SwRect &rPg = rSh.GetAnyCurRect(RECT_PAGE); @@ -468,6 +499,11 @@ void SwFrameShell::Execute(SfxRequest &rReq) nDefPage); DBG_ASSERT(pDlg, "Dialogdiet fail!"); + if ( nSlot == FN_PROPERTY_WRAP_DLG ) + { + pDlg->SetCurPageId(TP_FRM_WRAP); + } + if ( pDlg->Execute() ) { const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); @@ -638,16 +674,17 @@ void SwFrameShell::Execute(SfxRequest &rReq) ASSERT( !this, "falscher Dispatcher" ); return; } - // Vorlagen-AutoUpdate - SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); if ( bUpdateMgr ) { - if(bCopyToFmt && pFmt && pFmt->IsAutoUpdateFmt()) + SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); + if ( bCopyToFmt && pFmt && pFmt->IsAutoUpdateFmt() ) { rSh.AutoUpdateFrame(pFmt, aMgr.GetAttrSet()); } else + { aMgr.UpdateFlyFrm(); + } } } @@ -862,6 +899,40 @@ void SwFrameShell::GetState(SfxItemSet& rSet) if ( bParentCntProt ) rSet.DisableItem( nWhich ); break; + + case SID_ATTR_TRANSFORM: + { + rSet.DisableItem( nWhich ); + } + break; + + case SID_ATTR_TRANSFORM_PROTECT_SIZE: + { + const sal_uInt8 eProtection = rSh.IsSelObjProtected( FLYPROTECT_SIZE ); + if ( ( eProtection & FLYPROTECT_CONTENT ) || + ( eProtection & FLYPROTECT_SIZE ) ) + { + rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, sal_True ) ); + } + else + { + rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, sal_False ) ); + } + } + break; + + case SID_ATTR_TRANSFORM_WIDTH: + { + rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_WIDTH, aMgr.GetSize().getWidth() ) ); + } + break; + + case SID_ATTR_TRANSFORM_HEIGHT: + { + rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_HEIGHT, aMgr.GetSize().getHeight() ) ); + } + break; + case FN_FORMAT_FRAME_DLG: { const int nSel = rSh.GetSelectionType(); @@ -869,7 +940,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) rSet.DisableItem( nWhich ); } break; - // --> OD 2009-07-07 #i73249# + case FN_TITLE_DESCRIPTION_SHAPE: { SwWrtShell &rWrtSh = GetShell(); @@ -882,7 +953,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) } break; - // <-- + default: /* do nothing */; break; @@ -906,6 +977,8 @@ SwFrameShell::SwFrameShell(SwView &_rView) : /* #96392# Use this to announce it is the frame shell who creates the selection. */ SwTransferable::CreateSelection( _rView.GetWrtShell(), (ViewShell *) this ); + + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Frame)); } SwFrameShell::~SwFrameShell() @@ -1148,4 +1221,3 @@ void SwFrameShell::StateInsert(SfxItemSet &rSet) if ((nSel & nsSelectionType::SEL_GRF) || (nSel & nsSelectionType::SEL_OLE)) rSet.DisableItem(FN_INSERT_FRAME); } - diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx index 7c869c6f3024..c60f32b80955 100644 --- a/sw/source/ui/shells/grfsh.cxx +++ b/sw/source/ui/shells/grfsh.cxx @@ -43,6 +43,7 @@ #include <editeng/sizeitem.hxx> #include <editeng/protitem.hxx> #include <sfx2/request.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svl/srchitem.hxx> #include <svx/htmlmode.hxx> #include <svx/sdgluitm.hxx> @@ -113,6 +114,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) break; case SID_INSERT_GRAPHIC: case FN_FORMAT_GRAFIC_DLG: + case FN_PROPERTY_WRAP_DLG: { SwFlyFrmAttrMgr aMgr( sal_False, &rSh, rSh.IsFrmSelected() ? FRMMGR_TYPE_NONE : FRMMGR_TYPE_GRF); @@ -149,10 +151,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName())); if ( nSlot == FN_FORMAT_GRAFIC_DLG ) { - // --> OD 2009-07-13 #i73249# -// aSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, rSh.GetAlternateText())); aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) ); - // <-- } pRect = &rSh.GetAnyCurRect(RECT_PAGE_PRT); @@ -230,6 +229,10 @@ void SwGrfShell::Execute(SfxRequest &rReq) GetView().GetWindow(), aSet, sal_False, DLG_FRM_GRF); DBG_ASSERT(pDlg, "Dialogdiet fail!"); + + if (nSlot == FN_PROPERTY_WRAP_DLG) + pDlg->SetCurPageId(TP_FRM_WRAP); + if( pDlg->Execute() ) { rSh.StartAllAction(); @@ -381,12 +384,14 @@ void SwGrfShell::ExecAttr( SfxRequest &rReq ) { case FN_FLIP_VERT_GRAFIC: case FN_FLIP_HORZ_GRAFIC: + case SID_FLIP_VERTICAL: + case SID_FLIP_HORIZONTAL: { GetShell().GetCurAttr( aGrfSet ); SwMirrorGrf aMirror( (SwMirrorGrf&)aGrfSet.Get( RES_GRFATR_MIRRORGRF ) ); sal_uInt16 nMirror = aMirror.GetValue(); - if( FN_FLIP_VERT_GRAFIC == nSlot ) + if( FN_FLIP_VERT_GRAFIC == nSlot || nSlot==SID_FLIP_VERTICAL ) switch( nMirror ) { case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_VERT; @@ -692,4 +697,5 @@ SwGrfShell::SwGrfShell(SwView &_rView) : { SetName(String::CreateFromAscii("Graphic")); SetHelpId(SW_GRFSHELL); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Graphic)); } diff --git a/sw/source/ui/shells/mediash.cxx b/sw/source/ui/shells/mediash.cxx index 17077e860a03..232896389d4a 100644 --- a/sw/source/ui/shells/mediash.cxx +++ b/sw/source/ui/shells/mediash.cxx @@ -75,6 +75,7 @@ #endif #include <sfx2/objface.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/svdomedia.hxx> #include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx> #include <avmedia/mediaitem.hxx> @@ -215,4 +216,5 @@ SwMediaShell::SwMediaShell(SwView &_rView) : { SetName(String::CreateFromAscii("Media Playback")); SetHelpId(SW_MEDIASHELL); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Media)); } diff --git a/sw/source/ui/shells/olesh.cxx b/sw/source/ui/shells/olesh.cxx index 142e4bc60b25..6f8f860b2a4b 100644 --- a/sw/source/ui/shells/olesh.cxx +++ b/sw/source/ui/shells/olesh.cxx @@ -29,6 +29,7 @@ #include <sfx2/request.hxx> #include <sfx2/objface.hxx> #include <sfx2/objitem.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <wrtsh.hxx> #include <view.hxx> #ifndef _HELPID_H @@ -71,6 +72,5 @@ SwOleShell::SwOleShell(SwView &_rView) : { SetName(String::CreateFromAscii("Object")); SetHelpId(SW_OLESHELL); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OLE)); } - - diff --git a/sw/source/ui/shells/slotadd.cxx b/sw/source/ui/shells/slotadd.cxx index cea3e1f471b2..85f440fe186f 100644 --- a/sw/source/ui/shells/slotadd.cxx +++ b/sw/source/ui/shells/slotadd.cxx @@ -137,6 +137,11 @@ #define SvxDrawBezierItem SfxAllEnumItem #define avmedia_MediaItem ::avmedia::MediaItem +#include <svx/xflftrit.hxx> +#include <svx/xlncapit.hxx> +#include <svx/xlinjoit.hxx> +#include <svx/AffineMatrixItem.hxx> + #define SFX_TYPEMAP #include <sfx2/msg.hxx> #include "swslots.hxx" diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx index ce02f9ae4079..1d6b4ae1e57c 100644 --- a/sw/source/ui/shells/tabsh.cxx +++ b/sw/source/ui/shells/tabsh.cxx @@ -54,6 +54,7 @@ #include <sfx2/request.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/objface.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <fmtornt.hxx> @@ -1178,16 +1179,17 @@ void SwTableShell::Execute(SfxRequest &rReq) aMgr.ColWidthDlg(GetView().GetWindow()); } break; - case FN_TABLE_VERT_NONE: - case FN_TABLE_VERT_CENTER: - case FN_TABLE_VERT_BOTTOM: + case SID_TABLE_VERT_NONE: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_BOTTOM: { - sal_uInt16 nAlign = nSlot == FN_TABLE_VERT_NONE ? + sal_uInt16 nAlign = nSlot == SID_TABLE_VERT_NONE ? text::VertOrientation::NONE : - nSlot == FN_TABLE_VERT_CENTER ? + nSlot == SID_TABLE_VERT_CENTER ? text::VertOrientation::CENTER : text::VertOrientation::BOTTOM; rSh.SetBoxAlign(nAlign); bCallDone = sal_True; + } break; @@ -1321,14 +1323,15 @@ void SwTableShell::GetState(SfxItemSet &rSet) case RES_UL_SPACE: rSet.Put(pFmt->GetULSpace()); break; - case FN_TABLE_VERT_NONE: - case FN_TABLE_VERT_CENTER: - case FN_TABLE_VERT_BOTTOM: + + case SID_TABLE_VERT_NONE: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_BOTTOM: { sal_uInt16 nAlign = rSh.GetBoxAlign(); - sal_Bool bSet = (nSlot == FN_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE) || - (nSlot == FN_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER) || - (nSlot == FN_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM); + sal_Bool bSet = nSlot == SID_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE|| + nSlot == SID_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER || + nSlot == SID_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM; rSet.Put(SfxBoolItem(nSlot, bSet)); } break; @@ -1433,6 +1436,7 @@ SwTableShell::SwTableShell(SwView &_rView) : { SetName(String::CreateFromAscii("Table")); SetHelpId(SW_TABSHELL); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Table)); } /*-------------------------------------------------------------------- @@ -1591,4 +1595,3 @@ void SwTableShell::ExecNumberFormat(SfxRequest& rReq) } } - diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index ae6cb9a0cdaa..da07d2e2d14a 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -108,6 +108,7 @@ #define TextFont #define DropCap #include <sfx2/msg.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <swslots.hxx> #include <SwRewriter.hxx> #include <comcore.hrc> @@ -1027,6 +1028,7 @@ SwTextShell::SwTextShell(SwView &_rView) : { SetName(String::CreateFromAscii("Text")); SetHelpId(SW_TEXTSHELL); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Text)); } /*-------------------------------------------------------------------- @@ -1214,5 +1216,3 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) } } } - - diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index 485e999e6e5a..1601c3cd3b22 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -126,7 +126,19 @@ #include <sfx2/objface.hxx> #include <langhelper.hxx> +#ifndef _NBDTMGFACT_HXX +#include <svx/nbdtmgfact.hxx> +#endif +#ifndef _NBDTMG_HXX +#include <svx/nbdtmg.hxx> +#endif + + +#include <numrule.hxx> + + using namespace ::com::sun::star; +using namespace svx::sidebar; void lcl_CharDialog( SwWrtShell &rWrtSh, sal_Bool bUseDialog, sal_uInt16 nSlot,const SfxItemSet *pArgs, SfxRequest *pReq ) @@ -185,6 +197,10 @@ void lcl_CharDialog( SwWrtShell &rWrtSh, sal_Bool bUseDialog, sal_uInt16 nSlot,c if( FN_INSERT_HYPERLINK == nSlot ) pDlg->SetCurPageId(TP_CHAR_URL); } + if (nSlot == SID_CHAR_DLG_EFFECT) + { + pDlg->SetCurPageId(TP_CHAR_EXT); + } const SfxItemSet* pSet = NULL; if ( !bUseDialog ) @@ -838,6 +854,7 @@ void SwTextShell::Execute(SfxRequest &rReq) // intentionally no break } case SID_CHAR_DLG: + case SID_CHAR_DLG_EFFECT: { lcl_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq ); } @@ -862,6 +879,7 @@ void SwTextShell::Execute(SfxRequest &rReq) case FN_NUMBER_NEWSTART_AT : case FN_FORMAT_DROPCAPS : case FN_DROP_TEXT: + case SID_ATTR_PARA_LRSPACE: { sal_uInt16 nWhich = GetPool().GetWhich( nSlot ); if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET ) @@ -952,7 +970,15 @@ void SwTextShell::Execute(SfxRequest &rReq) SfxItemSet* pSet = NULL; if ( !bUseDialog ) { - pSet = (SfxItemSet*) pArgs; + if ( nSlot == SID_ATTR_PARA_LRSPACE) + { + SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)pArgs->Get(nSlot)); + aParaMargin.SetWhich( RES_LR_SPACE); + aCoreSet.Put(aParaMargin); + pSet = &aCoreSet; + + } else + pSet = (SfxItemSet*) pArgs; } else if ( NULL != pDlg && pDlg->Execute() == RET_OK ) @@ -1023,14 +1049,14 @@ void SwTextShell::Execute(SfxRequest &rReq) //SetNumRuleStart(sal_True) restarts the numbering at the value //that is defined at the starting point of the numbering level //otherwise the SetNodeNumStart() value determines the start - //if it's set to something different than USHRT_MAX + //if it's set to something different than (sal_uInt16)0xFFFF sal_Bool bStart = ((SfxBoolItem&)pSet->Get(FN_NUMBER_NEWSTART)).GetValue(); // --> OD 2007-06-11 #b6560525# - // Default value for restart value has to be USHRT_MAX + // Default value for restart value has to be (sal_uInt16)0xFFFF // in order to indicate that the restart value of the list // style has to be used on restart. - sal_uInt16 nNumStart = USHRT_MAX; + sal_uInt16 nNumStart = (sal_uInt16)0xFFFF; // <-- if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) ) { @@ -1677,6 +1703,51 @@ void SwTextShell::GetState( SfxItemSet &rSet ) rSet.DisableItem(nWhich); } break; + case FN_NUM_NUMBERING_ON: + rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON,rSh.SelectionHasNumber())); + break; + case FN_NUM_BULLET_ON: + rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON,rSh.SelectionHasBullet())); + break; + case FN_BUL_NUM_RULE_INDEX: + case FN_NUM_NUM_RULE_INDEX: + { + SwNumRule* pCurRule = (SwNumRule*)(GetShell().GetCurNumRule()); + sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE)); + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE)); + if( pCurRule ) + { + nActNumLvl = GetShell().GetNumLevel(); + if( nActNumLvl < MAXLEVEL ) + { + nActNumLvl = 1<<nActNumLvl; + } + SvxNumRule aSvxRule = pCurRule->MakeSvxNumRule(); + if ( GetShell().HasBullet()) + { + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); + if ( pBullets ) + { + sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(aSvxRule,nActNumLvl); + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex)); + } + }else if ( GetShell().HasNumber() ) + { + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); + if ( pNumbering ) + { + sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(aSvxRule,nActNumLvl); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex)); + } + } + } + } + break; case FN_NUM_CONTINUE: { // --> OD 2009-08-26 #i86492# @@ -1775,7 +1846,7 @@ void SwTextShell::ChangeHeaderOrFooter( if( !bCrsrSet && bOn ) bCrsrSet = rSh.SetCrsrInHdFt( - !rStyleName.Len() ? USHRT_MAX : nFrom, + !rStyleName.Len() ? (sal_uInt16)0xFFFF : nFrom, bHeader ); } } diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx index 217a2b8f3e64..181e0dafc2a9 100644 --- a/sw/source/ui/shells/txtattr.cxx +++ b/sw/source/ui/shells/txtattr.cxx @@ -40,6 +40,7 @@ #include <editeng/fhgtitem.hxx> #include <editeng/adjitem.hxx> #include <editeng/lspcitem.hxx> +#include <editeng/lrspitem.hxx> #include <editeng/udlnitem.hxx> #include <editeng/escpitem.hxx> #include <svx/htmlmode.hxx> @@ -745,6 +746,19 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet) rSet.Put(SvxAdjustItem((SvxAdjust)eAdjust, SID_ATTR_PARA_ADJUST )); nSlot = 0; break; + case SID_ATTR_PARA_LRSPACE: + { + eState = aCoreSet.GetItemState(RES_LR_SPACE); + if( eState >= SFX_ITEM_DEFAULT ) + { + SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aCoreSet.Get( RES_LR_SPACE ) ); + aLR.SetWhich(SID_ATTR_PARA_LRSPACE); + rSet.Put(aLR); + } + else + rSet.InvalidateItem(nSlot); + nSlot = 0; + } case SID_ATTR_PARA_LEFT_TO_RIGHT : case SID_ATTR_PARA_RIGHT_TO_LEFT : diff --git a/sw/source/ui/shells/txtnum.cxx b/sw/source/ui/shells/txtnum.cxx index 13a44cac34a7..0b53d940e5a9 100644 --- a/sw/source/ui/shells/txtnum.cxx +++ b/sw/source/ui/shells/txtnum.cxx @@ -46,6 +46,11 @@ #include "swabstdlg.hxx" #include <globals.hrc> #include <sfx2/tabdlg.hxx> +#include <svx/nbdtmg.hxx> +#include <svx/nbdtmgfact.hxx> +#include <sfx2/viewfrm.hxx> +#include <sfx2/bindings.hxx> +using namespace svx::sidebar; void SwTextShell::ExecEnterNum(SfxRequest &rReq) { @@ -54,14 +59,15 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) { case FN_NUM_NUMBERING_ON: { + GetShell().StartAllAction(); SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False ); - sal_Bool bMode = !GetShell().HasNumber(); // #i29560# + sal_Bool bMode = !GetShell().SelectionHasNumber(); // #i29560# if ( pItem ) bMode = pItem->GetValue(); else rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) ); - if ( bMode != (GetShell().HasNumber()) ) // #i29560# + if ( bMode != (GetShell().SelectionHasNumber()) ) // #i29560# { rReq.Done(); if( bMode ) @@ -69,18 +75,28 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) else GetShell().NumOrBulletOff(); // #i29560# } + sal_Bool bNewResult = GetShell().SelectionHasNumber(); + if (bNewResult!=bMode) { + SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings(); + SfxBoolItem aItem(FN_NUM_NUMBERING_ON,!bNewResult); + rBindings.SetState(aItem); + SfxBoolItem aNewItem(FN_NUM_NUMBERING_ON,bNewResult); + rBindings.SetState(aNewItem); + } + GetShell().EndAllAction(); } break; case FN_NUM_BULLET_ON: { + GetShell().StartAllAction(); SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False ); - sal_Bool bMode = !GetShell().HasBullet(); // #i29560# + sal_Bool bMode = !GetShell().SelectionHasBullet(); // #i29560# if ( pItem ) bMode = pItem->GetValue(); else rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) ); - if ( bMode != (GetShell().HasBullet()) ) // #i29560# + if ( bMode != (GetShell().SelectionHasBullet()) ) // #i29560# { rReq.Done(); if( bMode ) @@ -88,9 +104,19 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) else GetShell().NumOrBulletOff(); // #i29560# } + sal_Bool bNewResult = GetShell().SelectionHasBullet(); + if (bNewResult!=bMode) { + SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings(); + SfxBoolItem aItem(FN_NUM_BULLET_ON,!bNewResult); + rBindings.SetState(aItem); + SfxBoolItem aNewItem(FN_NUM_BULLET_ON,bNewResult); + rBindings.SetState(aNewItem); + } + GetShell().EndAllAction(); } break; case FN_NUMBER_BULLETS: + case SID_OUTLINE_BULLET: { // --> OD 2008-02-29 #refactorlists# // // per default sal_True, damit die Schleife im Dialog richtig arbeitet! @@ -244,4 +270,179 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) } } +void SwTextShell::ExecSetNumber(SfxRequest &rReq) +{ + SwNumRule aRule( GetShell().GetUniqueNumRuleName(), + // --> OD 2008-06-06 #i89178# + numfunc::GetDefaultPositionAndSpaceMode() ); + // <-- + + SvxNumRule aSvxRule = aRule.MakeSvxNumRule(); + const bool bRightToLeft = GetShell().IsInRightToLeftText( 0 ); + + if( bRightToLeft ) + { + for( sal_uInt8 n = 0; n < MAXLEVEL; ++n ) + { + SvxNumberFormat aFmt( aSvxRule.GetLevel( n ) ); + /* if ( n && bHtml ) + { + // 1/2" fuer HTML + aFmt.SetLSpace(720); + aFmt.SetAbsLSpace(n * 720); + }*/ + // --> FME 2005-01-21 #i38904# Default alignment for + // numbering/bullet should be rtl in rtl paragraph: + if ( bRightToLeft ) + { + aFmt.SetNumAdjust( SVX_ADJUST_RIGHT ); + } + // <-- + aSvxRule.SetLevel( n, aFmt, sal_False ); + } + aSvxRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, sal_False); + } + + const SwNumRule* pCurRule = GetShell().GetCurNumRule(); + sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; + if( pCurRule ) + { + sal_uInt16 nLevel = GetShell().GetNumLevel(); + if( nLevel < MAXLEVEL ) + { + nActNumLvl = 1<<nLevel; + } + + aSvxRule = pCurRule->MakeSvxNumRule(); + //convert type of linked bitmaps from SVX_NUM_BITMAP to (SVX_NUM_BITMAP|LINK_TOKEN) + for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++) + { + SvxNumberFormat aFmt(aSvxRule.GetLevel(i)); + if(SVX_NUM_BITMAP == aFmt.GetNumberingType()) + { + const SvxBrushItem* pBrush = aFmt.GetBrush(); + const String* pLinkStr; + if(pBrush && + 0 != (pLinkStr = pBrush->GetGraphicLink()) && + pLinkStr->Len()) + aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN)); + aSvxRule.SetLevel(i, aFmt, aSvxRule.Get(i) != 0); + } + } + } + + + switch(rReq.GetSlot()) + { + case FN_SVX_SET_NUMBER: + { + SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_NUMBER , sal_False ); + if (pItem) + { + sal_uInt16 nIdx = pItem->GetValue(); + if (nIdx==DEFAULT_NONE) { + GetShell().DelNumRules(); + break; + } + --nIdx; + + NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); + if ( pNumbering ) + { + SwNumRule aTmpRule( GetShell().GetUniqueNumRuleName(), + numfunc::GetDefaultPositionAndSpaceMode() ); + + SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule(); + //Sym3_2508, set unit attribute to NB Manager + SfxItemSet aSet(GetPool(), + SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL, + 0 ); + aSet.Put(SvxNumBulletItem(aTempRule)); + pNumbering->SetItems(&aSet); + pNumbering->ApplyNumRule(aTempRule,nIdx,nActNumLvl); + + sal_uInt16 nMask = 1; + for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aFmt(aTempRule.GetLevel(i)); + aSvxRule.SetLevel(i, aFmt); + } + nMask <<= 1 ; + } + + aSvxRule.UnLinkGraphics(); + SwNumRule aSetRule( pCurRule + ? pCurRule->GetName() + : GetShell().GetUniqueNumRuleName(), + numfunc::GetDefaultPositionAndSpaceMode() ); + aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc()); + + aSetRule.SetAutoRule( sal_True ); + const bool bCreateList = (pCurRule == 0); + GetShell().SetCurNumRule( aSetRule, bCreateList ); + } + //End + } + break; + } + case FN_SVX_SET_BULLET: + { + SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_BULLET , sal_False ); + if (pItem) + { + sal_uInt16 nIdx = pItem->GetValue(); + if (nIdx==DEFAULT_NONE) { + GetShell().DelNumRules(); + break; + } + nIdx--; + + NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); + if ( pBullets ) + { + SwNumRule aTmpRule( GetShell().GetUniqueNumRuleName(), + numfunc::GetDefaultPositionAndSpaceMode() ); + + SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule(); + //Sym3_2508, set unit attribute to NB Manager + SfxItemSet aSet(GetPool(), + SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL, + 0 ); + aSet.Put(SvxNumBulletItem(aTempRule)); + pBullets->SetItems(&aSet); + + //SvxNumRule aTempRule( 0, 10, false ); + pBullets->ApplyNumRule(aTempRule,nIdx,nActNumLvl); + sal_uInt16 nMask = 1; + for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aFmt(aTempRule.GetLevel(i)); + aSvxRule.SetLevel(i, aFmt); + } + nMask <<= 1; + } + aSvxRule.UnLinkGraphics(); + + SwNumRule aSetRule( pCurRule + ? pCurRule->GetName() + : GetShell().GetUniqueNumRuleName(), + numfunc::GetDefaultPositionAndSpaceMode() ); + + aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc()); + + aSetRule.SetAutoRule( sal_True ); + const bool bCreateList = (pCurRule == 0); + GetShell().SetCurNumRule( aSetRule, bCreateList ); + } + //End + } + + } + break; + } +} diff --git a/sw/source/ui/sidebar/PageColumnControl.cxx b/sw/source/ui/sidebar/PageColumnControl.cxx new file mode 100644 index 000000000000..a2e2909dc92f --- /dev/null +++ b/sw/source/ui/sidebar/PageColumnControl.cxx @@ -0,0 +1,115 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sw.hxx" + +#include "PageColumnControl.hxx" +#include "PagePropertyPanel.hxx" +#include "PagePropertyPanel.hrc" + +#include <cmdid.h> +#include <swtypes.hxx> + +#include <svx/sidebar/ValueSetWithTextControl.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> + +namespace sw { namespace sidebar { + +PageColumnControl::PageColumnControl( + Window* pParent, + PagePropertyPanel& rPanel, + const sal_uInt16 nColumnType, + const bool bLandscape ) + : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_COLUMN) ) + , mpColumnValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_COLUMN) ) ) + , maMoreButton( this, SW_RES(CB_COLUMN_MORE) ) + , mnColumnType( nColumnType ) + , mrPagePropPanel(rPanel) +{ + mpColumnValueSet->SetStyle( mpColumnValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT ); + mpColumnValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor()); + + if ( bLandscape ) + { + mpColumnValueSet->AddItem( SW_RES(IMG_ONE_L), 0, SW_RES(STR_ONE), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_TWO_L), 0, SW_RES(STR_TWO), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_THREE_L), 0, SW_RES(STR_THREE), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_LEFT_L), 0, SW_RES(STR_LEFT), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_RIGHT_L), 0, SW_RES(STR_RIGHT), 0 ); + } + else + { + mpColumnValueSet->AddItem( SW_RES(IMG_ONE), 0, SW_RES(STR_ONE), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_TWO), 0, SW_RES(STR_TWO), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_THREE), 0, SW_RES(STR_THREE), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_LEFT), 0, SW_RES(STR_LEFT), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_RIGHT), 0, SW_RES(STR_RIGHT), 0 ); + } + + mpColumnValueSet->SetNoSelection(); + mpColumnValueSet->SetSelectHdl( LINK(this, PageColumnControl,ImplColumnHdl ) ); + mpColumnValueSet->Show(); + mpColumnValueSet->SelectItem( mnColumnType ); + mpColumnValueSet->Format(); + mpColumnValueSet->StartSelection(); + + maMoreButton.SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) ); + maMoreButton.GrabFocus(); + + FreeResource(); +} + + +PageColumnControl::~PageColumnControl(void) +{ + delete mpColumnValueSet; +} + + +IMPL_LINK(PageColumnControl, ImplColumnHdl, void *, pControl) +{ + mpColumnValueSet->SetNoSelection(); + if ( pControl == mpColumnValueSet ) + { + const sal_uInt32 nColumnType = mpColumnValueSet->GetSelectItemId(); + if ( nColumnType != mnColumnType ) + { + mnColumnType = nColumnType; + mrPagePropPanel.ExecuteColumnChange( mnColumnType ); + } + } + + mrPagePropPanel.ClosePageColumnPopup(); + return 0; +} + +IMPL_LINK(PageColumnControl, MoreButtonClickHdl_Impl, void *, EMPTYARG) +{ + mrPagePropPanel.GetBindings()->GetDispatcher()->Execute( FN_FORMAT_PAGE_COLUMN_DLG, SFX_CALLMODE_ASYNCHRON ); + + mrPagePropPanel.ClosePageColumnPopup(); + return 0; +} + + +} } // end of namespace sw::sidebar + diff --git a/sw/source/ui/sidebar/PageColumnControl.hxx b/sw/source/ui/sidebar/PageColumnControl.hxx new file mode 100644 index 000000000000..e281dd6d35b2 --- /dev/null +++ b/sw/source/ui/sidebar/PageColumnControl.hxx @@ -0,0 +1,67 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SW_SIDEBAR_PAGE_COLUMN_CONTROL_HXX_ +#define _SW_SIDEBAR_PAGE_COLUMN_CONTROL_HXX_ + +#include <svx/sidebar/PopupControl.hxx> + +#include <vcl/image.hxx> +#include <vcl/button.hxx> + +#include <vector> + +namespace svx { namespace sidebar { + class ValueSetWithTextControl; +} } + +namespace sw { namespace sidebar { + +class PagePropertyPanel; + + +class PageColumnControl + : public ::svx::sidebar::PopupControl +{ +public: + PageColumnControl( + Window* pParent, + PagePropertyPanel& rPanel, + const sal_uInt16 nColumnType, + const bool bLandscape ); + + ~PageColumnControl(void); + +private: + ::svx::sidebar::ValueSetWithTextControl* mpColumnValueSet; + PushButton maMoreButton; + + sal_uInt16 mnColumnType; + + PagePropertyPanel& mrPagePropPanel; + + DECL_LINK(ImplColumnHdl, void*); + DECL_LINK(MoreButtonClickHdl_Impl, void*); +}; + +} } // end of namespace sw::sidebar + +#endif diff --git a/sw/source/ui/sidebar/PageMarginControl.cxx b/sw/source/ui/sidebar/PageMarginControl.cxx new file mode 100644 index 000000000000..c0697b1f29f4 --- /dev/null +++ b/sw/source/ui/sidebar/PageMarginControl.cxx @@ -0,0 +1,523 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sw.hxx" + +#include "PageMarginControl.hxx" +#include "PagePropertyPanel.hxx" +#include "PagePropertyPanel.hrc" + +#include <swtypes.hxx> + +#include <svx/sidebar/ValueSetWithTextControl.hxx> + +#define SWPAGE_LEFT_GVALUE String("Sw_Page_Left", 12, RTL_TEXTENCODING_ASCII_US) +#define SWPAGE_RIGHT_GVALUE String("Sw_Page_Right", 13, RTL_TEXTENCODING_ASCII_US) +#define SWPAGE_TOP_GVALUE String("Sw_Page_Top", 11, RTL_TEXTENCODING_ASCII_US) +#define SWPAGE_DOWN_GVALUE String("Sw_Page_Down", 12, RTL_TEXTENCODING_ASCII_US) +#define SWPAGE_MIRROR_GVALUE String("Sw_Page_Mirrored", 16, RTL_TEXTENCODING_ASCII_US) + + +namespace sw { namespace sidebar { + +PageMarginControl::PageMarginControl( + Window* pParent, + PagePropertyPanel& rPanel, + const SvxLongLRSpaceItem& aPageLRMargin, + const SvxLongULSpaceItem& aPageULMargin, + const bool bMirrored, + const Size aPageSize, + const sal_Bool bLandscape, + const FieldUnit eFUnit, + const SfxMapUnit eUnit ) + : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_MARGIN) ) + , mpMarginValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_MARGIN) ) ) + , maCustom(this, SW_RES(FT_CUSTOM)) + , maLeft(this, SW_RES(FT_LEFT)) + , maInner(this, SW_RES(FT_INNER)) + , maLeftMarginEdit(this, SW_RES(MF_SWLEFT_MARGIN)) + , maRight(this, SW_RES(FT_RIGHT)) + , maOuter(this, SW_RES(FT_OUTER)) + , maRightMarginEdit(this, SW_RES(MF_SWRIGHT_MARGIN)) + , maTop(this, SW_RES(FT_TOP)) + , maTopMarginEdit(this, SW_RES(MF_SWTOP_MARGIN)) + , maBottom(this, SW_RES(FT_BOTTOM)) + , maBottomMarginEdit(this, SW_RES(MF_SWBOTTOM_MARGIN)) + , maWidthHeightField( this, SW_RES(FLD_WIDTH_HEIGHT) ) + , mnPageLeftMargin( aPageLRMargin.GetLeft() ) + , mnPageRightMargin( aPageLRMargin.GetRight() ) + , mnPageTopMargin( aPageULMargin.GetUpper() ) + , mnPageBottomMargin( aPageULMargin.GetLower() ) + , mbMirrored( bMirrored ) + , meUnit( eUnit ) + , mbUserCustomValuesAvailable(false) + , mnUserCustomPageLeftMargin(0) + , mnUserCustomPageRightMargin(0) + , mnUserCustomPageTopMargin(0) + , mnUserCustomPageBottomMargin(0) + , mbUserCustomMirrored(false) + , mbCustomValuesUsed( false ) + , mrPagePropPanel(rPanel) +{ + maWidthHeightField.Hide(); + SetFieldUnit( maWidthHeightField, eFUnit ); + + mbUserCustomValuesAvailable = GetUserCustomValues(); + + mpMarginValueSet->SetStyle( mpMarginValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT ); + mpMarginValueSet->SetColor( GetSettings().GetStyleSettings().GetMenuColor() ); + + FillValueSet( bLandscape, mbUserCustomValuesAvailable ); + + mpMarginValueSet->SetNoSelection(); + mpMarginValueSet->SetSelectHdl( LINK(this, PageMarginControl,ImplMarginHdl ) ); + mpMarginValueSet->Show(); + + SelectValueSetItem(); + + SetFieldUnit( maLeftMarginEdit, eFUnit ); + Link aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl ); + maLeftMarginEdit.SetModifyHdl( aLinkLR ); + SetMetricValue( maLeftMarginEdit, mnPageLeftMargin, meUnit ); + + SetFieldUnit( maRightMarginEdit, eFUnit ); + maRightMarginEdit.SetModifyHdl( aLinkLR ); + SetMetricValue( maRightMarginEdit, mnPageRightMargin, meUnit ); + + Link aLinkUL = LINK( this, PageMarginControl, ModifyULMarginHdl ); + SetFieldUnit( maTopMarginEdit, eFUnit ); + maTopMarginEdit.SetModifyHdl( aLinkUL ); + SetMetricValue( maTopMarginEdit, mnPageTopMargin, meUnit ); + + SetFieldUnit( maBottomMarginEdit, eFUnit ); + maBottomMarginEdit.SetModifyHdl( aLinkUL ); + SetMetricValue( maBottomMarginEdit, mnPageBottomMargin, meUnit ); + + SetMetricFieldMaxValues( aPageSize ); + + if ( mbMirrored ) + { + maLeft.Hide(); + maRight.Hide(); + maInner.Show(); + maOuter.Show(); + } + else + { + maLeft.Show(); + maRight.Show(); + maInner.Hide(); + maOuter.Hide(); + } + + FreeResource(); +} + + +PageMarginControl::~PageMarginControl(void) +{ + delete mpMarginValueSet; + + StoreUserCustomValues(); +} + + +void PageMarginControl::SetMetricFieldMaxValues( const Size aPageSize ) +{ + const long nML = maLeftMarginEdit.Denormalize( maLeftMarginEdit.GetValue(FUNIT_TWIP) ); + const long nMR = maRightMarginEdit.Denormalize( maRightMarginEdit.GetValue(FUNIT_TWIP) ); + const long nMT = maTopMarginEdit.Denormalize(maTopMarginEdit.GetValue(FUNIT_TWIP) ); + const long nMB = maBottomMarginEdit.Denormalize( maBottomMarginEdit.GetValue(FUNIT_TWIP) ); + + const long nPH = LogicToLogic( aPageSize.Height(), (MapUnit)meUnit, MAP_TWIP ); + const long nPW = LogicToLogic( aPageSize.Width(), (MapUnit)meUnit, MAP_TWIP ); + + // Left + long nMax = nPW - nMR - MINBODY; + maLeftMarginEdit.SetMax(maLeftMarginEdit.Normalize(nMax), FUNIT_TWIP); + + // Right + nMax = nPW - nML - MINBODY; + maRightMarginEdit.SetMax(maRightMarginEdit.Normalize(nMax), FUNIT_TWIP); + + //Top + nMax = nPH - nMB - MINBODY; + maTopMarginEdit.SetMax(maTopMarginEdit.Normalize(nMax), FUNIT_TWIP); + + //Bottom + nMax = nPH - nMT - MINBODY; + maBottomMarginEdit.SetMax(maTopMarginEdit.Normalize(nMax), FUNIT_TWIP); +} + + +void PageMarginControl::FillValueSet( + const bool bLandscape, + const bool bUserCustomValuesAvailable ) +{ + const XubString aLeft = SW_RES(STR_MARGIN_TOOLTIP_LEFT); + const XubString aRight = SW_RES(STR_MARGIN_TOOLTIP_RIGHT); + const XubString aTop = SW_RES(STR_MARGIN_TOOLTIP_TOP); + const XubString aBottom = SW_RES(STR_MARGIN_TOOLTIP_BOT); + + SetMetricValue( maWidthHeightField, SWPAGE_NARROW_VALUE, meUnit ); + const XubString aNarrowValText = maWidthHeightField.GetText(); + XubString aHelpText = aLeft; + aHelpText += aNarrowValText; + aHelpText += aRight; + aHelpText += aNarrowValText; + aHelpText += aTop; + aHelpText += aNarrowValText; + aHelpText += aBottom; + aHelpText += aNarrowValText; + mpMarginValueSet->AddItem( + (bLandscape ? SW_RES(IMG_NARROW_L) : SW_RES(IMG_NARROW) ), 0, + SW_RES(STR_NARROW), &aHelpText ); + + SetMetricValue( maWidthHeightField, SWPAGE_NORMAL_VALUE, meUnit ); + const XubString aNormalValText = maWidthHeightField.GetText(); + aHelpText = aLeft; + aHelpText += aNormalValText; + aHelpText += aRight; + aHelpText += aNormalValText; + aHelpText += aTop; + aHelpText += aNormalValText; + aHelpText += aBottom; + aHelpText += aNormalValText; + mpMarginValueSet->AddItem( + (bLandscape ? SW_RES(IMG_NORMAL_L) : SW_RES(IMG_NORMAL) ), 0, + SW_RES(STR_NORMAL), &aHelpText ); + + SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE1, meUnit ); + const XubString aWide1ValText = maWidthHeightField.GetText(); + SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE2, meUnit ); + const XubString aWide2ValText = maWidthHeightField.GetText(); + aHelpText = aLeft; + aHelpText += aWide2ValText; + aHelpText += aRight; + aHelpText += aWide2ValText; + aHelpText += aTop; + aHelpText += aWide1ValText; + aHelpText += aBottom; + aHelpText += aWide1ValText; + mpMarginValueSet->AddItem( + (bLandscape ? SW_RES(IMG_WIDE_L) : SW_RES(IMG_WIDE) ), 0, + SW_RES(STR_WIDE), &aHelpText ); + + const XubString aInner = SW_RES(STR_MARGIN_TOOLTIP_INNER); + const XubString aOuter = SW_RES(STR_MARGIN_TOOLTIP_OUTER); + + SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE3, meUnit ); + const XubString aWide3ValText = maWidthHeightField.GetText(); + aHelpText = aInner; + aHelpText += aWide3ValText; + aHelpText += aOuter; + aHelpText += aWide3ValText; + aHelpText += aTop; + aHelpText += aWide1ValText; + aHelpText += aBottom; + aHelpText += aWide1ValText; + mpMarginValueSet->AddItem( + (bLandscape ? SW_RES(IMG_MIRRORED_L) : SW_RES(IMG_MIRRORED) ), 0, + SW_RES(STR_MIRRORED), &aHelpText ); + + if ( bUserCustomValuesAvailable ) + { + aHelpText = mbUserCustomMirrored ? aInner : aLeft; + SetMetricValue( maWidthHeightField, mnUserCustomPageLeftMargin, meUnit ); + aHelpText += maWidthHeightField.GetText(); + aHelpText += mbUserCustomMirrored ? aOuter : aRight; + SetMetricValue( maWidthHeightField, mnUserCustomPageRightMargin, meUnit ); + aHelpText += maWidthHeightField.GetText(); + aHelpText += aTop; + SetMetricValue( maWidthHeightField, mnUserCustomPageTopMargin, meUnit ); + aHelpText += maWidthHeightField.GetText(); + aHelpText += aBottom; + SetMetricValue( maWidthHeightField, mnUserCustomPageBottomMargin, meUnit ); + aHelpText += maWidthHeightField.GetText(); + } + else + { + aHelpText = XubString(); + } + mpMarginValueSet->AddItem( + (bUserCustomValuesAvailable ? SW_RES(IMG_CUSTOM) : SW_RES(IMG_CUSTOM_DIS) ), 0, + SW_RES(STR_LCVALUE), &aHelpText ); +} + + +void PageMarginControl::SelectValueSetItem() +{ + const long cTolerance = 5; + + if( abs(mnPageLeftMargin - SWPAGE_NARROW_VALUE) <= cTolerance && + abs(mnPageRightMargin - SWPAGE_NARROW_VALUE) <= cTolerance && + abs(mnPageTopMargin - SWPAGE_NARROW_VALUE) <= cTolerance && + abs(mnPageBottomMargin - SWPAGE_NARROW_VALUE) <= cTolerance && + !mbMirrored ) + { + mpMarginValueSet->SelectItem(1); + } + else if( abs(mnPageLeftMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && + abs(mnPageRightMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && + abs(mnPageTopMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && + abs(mnPageBottomMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && + !mbMirrored ) + { + mpMarginValueSet->SelectItem(2); + } + else if( abs(mnPageLeftMargin - SWPAGE_WIDE_VALUE2) <= cTolerance && + abs(mnPageRightMargin - SWPAGE_WIDE_VALUE2) <= cTolerance && + abs(mnPageTopMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + abs(mnPageBottomMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + !mbMirrored ) + { + mpMarginValueSet->SelectItem(3); + } + else if( abs(mnPageLeftMargin - SWPAGE_WIDE_VALUE3) <= cTolerance && + abs(mnPageRightMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + abs(mnPageTopMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + abs(mnPageBottomMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + mbMirrored ) + { + mpMarginValueSet->SelectItem(4); + } + else + { + mpMarginValueSet->SelectItem(0); + } + + mpMarginValueSet->Format(); + mpMarginValueSet->StartSelection(); +}; + + +IMPL_LINK(PageMarginControl, ImplMarginHdl, void *, pControl) +{ + if ( pControl == mpMarginValueSet ) + { + const sal_uInt16 iPos = mpMarginValueSet->GetSelectItemId(); + bool bMirrored = false; + bool bApplyNewPageMargins = true; + switch ( iPos ) + { + case 1: + mnPageLeftMargin = SWPAGE_NARROW_VALUE; + mnPageRightMargin = SWPAGE_NARROW_VALUE; + mnPageTopMargin = SWPAGE_NARROW_VALUE; + mnPageBottomMargin = SWPAGE_NARROW_VALUE; + bMirrored = false; + break; + case 2: + mnPageLeftMargin = SWPAGE_NORMAL_VALUE; + mnPageRightMargin = SWPAGE_NORMAL_VALUE; + mnPageTopMargin = SWPAGE_NORMAL_VALUE; + mnPageBottomMargin = SWPAGE_NORMAL_VALUE; + bMirrored = false; + break; + case 3: + mnPageLeftMargin = SWPAGE_WIDE_VALUE2; + mnPageRightMargin = SWPAGE_WIDE_VALUE2; + mnPageTopMargin = SWPAGE_WIDE_VALUE1; + mnPageBottomMargin = SWPAGE_WIDE_VALUE1; + bMirrored = false; + break; + case 4: + mnPageLeftMargin = SWPAGE_WIDE_VALUE3; + mnPageRightMargin = SWPAGE_WIDE_VALUE1; + mnPageTopMargin = SWPAGE_WIDE_VALUE1; + mnPageBottomMargin = SWPAGE_WIDE_VALUE1; + bMirrored = true; + break; + case 5: + if ( mbUserCustomValuesAvailable ) + { + mnPageLeftMargin = mnUserCustomPageLeftMargin; + mnPageRightMargin = mnUserCustomPageRightMargin; + mnPageTopMargin = mnUserCustomPageTopMargin; + mnPageBottomMargin = mnUserCustomPageBottomMargin; + bMirrored = mbUserCustomMirrored; + } + else + { + bApplyNewPageMargins = false; + } + break; + } + + if ( bApplyNewPageMargins ) + { + mpMarginValueSet->SetNoSelection(); + mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin ); + mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin ); + if ( mbMirrored != bMirrored ) + { + mbMirrored = bMirrored; + mrPagePropPanel.ExecutePageLayoutChange( mbMirrored ); + } + + mbCustomValuesUsed = false; + mrPagePropPanel.ClosePageMarginPopup(); + } + else + { + // back to initial selection + SelectValueSetItem(); + } + } + + return 0; +} + + +IMPL_LINK( PageMarginControl, ModifyLRMarginHdl, MetricField *, EMPTYARG ) +{ + mpMarginValueSet->SetNoSelection(); + mpMarginValueSet->SelectItem(0); + mpMarginValueSet->Format(); + mpMarginValueSet->StartSelection(); + + mnPageLeftMargin = GetCoreValue( maLeftMarginEdit, meUnit ); + mnPageRightMargin = GetCoreValue( maRightMarginEdit, meUnit ); + mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin ); + mbCustomValuesUsed = true; + return 0; +} + +IMPL_LINK( PageMarginControl, ModifyULMarginHdl, MetricField *, EMPTYARG ) +{ + mpMarginValueSet->SetNoSelection(); + mpMarginValueSet->SelectItem(0); + mpMarginValueSet->Format(); + mpMarginValueSet->StartSelection(); + + mnPageTopMargin = GetCoreValue( maTopMarginEdit, meUnit ); + mnPageBottomMargin = GetCoreValue( maBottomMarginEdit, meUnit ); + mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin ); + mbCustomValuesUsed = true; + return 0; +} + + +bool PageMarginControl::GetUserCustomValues() +{ + bool bUserCustomValuesAvailable = false; + + SvtViewOptions aWinOpt( E_WINDOW, SWPAGE_LEFT_GVALUE ); + if ( aWinOpt.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + String aWinData( aTmp ); + mnUserCustomPageLeftMargin = aWinData.ToInt32(); + bUserCustomValuesAvailable = true; + } + + SvtViewOptions aWinOpt2( E_WINDOW, SWPAGE_RIGHT_GVALUE ); + if ( aWinOpt2.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt2.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + String aWinData( aTmp ); + mnUserCustomPageRightMargin = aWinData.ToInt32(); + bUserCustomValuesAvailable = true; + } + + SvtViewOptions aWinOpt3( E_WINDOW, SWPAGE_TOP_GVALUE ); + if ( aWinOpt3.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt3.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + String aWinData( aTmp ); + mnUserCustomPageTopMargin = aWinData.ToInt32(); + bUserCustomValuesAvailable = true; + } + + SvtViewOptions aWinOpt4( E_WINDOW, SWPAGE_DOWN_GVALUE ); + if ( aWinOpt4.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt4.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + String aWinData( aTmp ); + mnUserCustomPageBottomMargin = aWinData.ToInt32(); + bUserCustomValuesAvailable = true; + } + + SvtViewOptions aWinOpt5( E_WINDOW, SWPAGE_MIRROR_GVALUE ); + if ( aWinOpt5.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt5.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + String aWinData( aTmp ); + mbUserCustomMirrored = aWinData.ToInt32() == 0 ? false : true; + bUserCustomValuesAvailable = true; + } + + return bUserCustomValuesAvailable; +} + +void PageMarginControl::StoreUserCustomValues() +{ + if ( !mbCustomValuesUsed ) + { + return; + } + + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); + SvtViewOptions aWinOpt( E_WINDOW, SWPAGE_LEFT_GVALUE ); + + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageLeftMargin") ); + aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageLeftMargin )); + aWinOpt.SetUserData( aSeq ); + + SvtViewOptions aWinOpt2( E_WINDOW, SWPAGE_RIGHT_GVALUE ); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageRightMargin") ); + aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageRightMargin )); + aWinOpt2.SetUserData( aSeq ); + + SvtViewOptions aWinOpt3( E_WINDOW, SWPAGE_TOP_GVALUE ); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageTopMargin") ); + aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageTopMargin )); + aWinOpt3.SetUserData( aSeq ); + + SvtViewOptions aWinOpt4( E_WINDOW, SWPAGE_DOWN_GVALUE ); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageBottomMargin") ); + aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageBottomMargin )); + aWinOpt4.SetUserData( aSeq ); + + SvtViewOptions aWinOpt5( E_WINDOW, SWPAGE_MIRROR_GVALUE ); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mbMirrored") ); + aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( (mbMirrored ? 1 : 0) )); + aWinOpt5.SetUserData( aSeq ); +} + + +} } // end of namespace sw::sidebar + diff --git a/sw/source/ui/sidebar/PageMarginControl.hxx b/sw/source/ui/sidebar/PageMarginControl.hxx new file mode 100644 index 000000000000..dd5f758ac9f6 --- /dev/null +++ b/sw/source/ui/sidebar/PageMarginControl.hxx @@ -0,0 +1,124 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SW_SIDEBAR_PAGE_MARGIN_CONTROL_HXX_ +#define _SW_SIDEBAR_PAGE_MARGIN_CONTROL_HXX_ + +#include <svx/sidebar/PopupControl.hxx> + +#include <tools/fldunit.hxx> +#include <svl/poolitem.hxx> +#include <svx/rulritem.hxx> +#include <unotools/viewoptions.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <svtools/unitconv.hxx> +#include <vector> + +#define SWPAGE_NARROW_VALUE 720 +#define SWPAGE_NORMAL_VALUE 1136 +#define SWPAGE_WIDE_VALUE1 1440 +#define SWPAGE_WIDE_VALUE2 2880 +#define SWPAGE_WIDE_VALUE3 1800 + + +namespace svx { namespace sidebar { + class ValueSetWithTextControl; +} } + +static const long MINBODY = 284; //0.5 cm in twips + +namespace sw { namespace sidebar { + +class PagePropertyPanel; + + +class PageMarginControl + : public ::svx::sidebar::PopupControl +{ +public: + PageMarginControl( + Window* pParent, + PagePropertyPanel& rPanel, + const SvxLongLRSpaceItem& aPageLRMargin, + const SvxLongULSpaceItem& aPageULMargin, + const bool bMirrored, + const Size aPageSize, + const sal_Bool bLandscape, + const FieldUnit eFUnit, + const SfxMapUnit eUnit ); + ~PageMarginControl(void); + +private: + ::svx::sidebar::ValueSetWithTextControl* mpMarginValueSet; + + FixedText maCustom; + FixedText maLeft; + FixedText maInner; + MetricField maLeftMarginEdit; + FixedText maRight; + FixedText maOuter; + MetricField maRightMarginEdit; + FixedText maTop; + MetricField maTopMarginEdit; + FixedText maBottom; + MetricField maBottomMarginEdit; + + // hidden metric field + MetricField maWidthHeightField; + + long mnPageLeftMargin; + long mnPageRightMargin; + long mnPageTopMargin; + long mnPageBottomMargin; + bool mbMirrored; + + const SfxMapUnit meUnit; + + bool mbUserCustomValuesAvailable; + long mnUserCustomPageLeftMargin; + long mnUserCustomPageRightMargin; + long mnUserCustomPageTopMargin; + long mnUserCustomPageBottomMargin; + bool mbUserCustomMirrored; + + bool mbCustomValuesUsed; + + PagePropertyPanel& mrPagePropPanel; + + DECL_LINK( ImplMarginHdl, void* ); + DECL_LINK( ModifyLRMarginHdl, MetricField* ); + DECL_LINK( ModifyULMarginHdl, MetricField* ); + + void SetMetricFieldMaxValues( const Size aPageSize ); + + bool GetUserCustomValues(); + void StoreUserCustomValues(); + + void FillValueSet( + const bool bLandscape, + const bool bUserCustomValuesAvailable ); + void SelectValueSetItem(); +}; + +} } // end of namespace sw::sidebar + +#endif diff --git a/sw/source/ui/sidebar/PageOrientationControl.cxx b/sw/source/ui/sidebar/PageOrientationControl.cxx new file mode 100644 index 000000000000..4c9fb0318d77 --- /dev/null +++ b/sw/source/ui/sidebar/PageOrientationControl.cxx @@ -0,0 +1,93 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sw.hxx" + +#include "PageOrientationControl.hxx" +#include "PagePropertyPanel.hxx" +#include "PagePropertyPanel.hrc" + +#include <swtypes.hxx> + +#include <svx/sidebar/ValueSetWithTextControl.hxx> + +namespace sw { namespace sidebar { + +PageOrientationControl::PageOrientationControl( + Window* pParent, + PagePropertyPanel& rPanel, + const sal_Bool bLandscape ) + : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_ORIENTATION) ) + , mpOrientationValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_ORIENTATION) ) ) + , mbLandscape( bLandscape ) + , mrPagePropPanel(rPanel) +{ + mpOrientationValueSet->SetStyle( mpOrientationValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT ); + mpOrientationValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor()); + + // initialize <ValueSetWithText> control + { + mpOrientationValueSet->AddItem( SW_RES(IMG_PORTRAIT), 0, SW_RES(STR_PORTRAIT), 0 ); + mpOrientationValueSet->AddItem( SW_RES(IMG_LANDSCAPE), 0, SW_RES(STR_LANDSCAPE), 0 ); + } + + Link aLink = LINK(this, PageOrientationControl,ImplOrientationHdl ); + mpOrientationValueSet->SetSelectHdl(aLink); + mpOrientationValueSet->SetNoSelection(); + mpOrientationValueSet->StartSelection(); + mpOrientationValueSet->Show(); + mpOrientationValueSet->SelectItem( (mbLandscape == sal_True) ? 2 : 1 ); + mpOrientationValueSet->GrabFocus(); + mpOrientationValueSet->Format(); + mpOrientationValueSet->StartSelection(); + + FreeResource(); +} + + +PageOrientationControl::~PageOrientationControl(void) +{ + delete mpOrientationValueSet; +} + + +IMPL_LINK(PageOrientationControl, ImplOrientationHdl, void *, pControl) +{ + mpOrientationValueSet->SetNoSelection(); + if ( pControl == mpOrientationValueSet ) + { + const sal_uInt32 iPos = mpOrientationValueSet->GetSelectItemId(); + const bool bChanged = ( ( iPos == 1 ) && mbLandscape ) || + ( ( iPos == 2 ) && !mbLandscape ); + if ( bChanged ) + { + mbLandscape = !mbLandscape; + mrPagePropPanel.ExecuteOrientationChange( mbLandscape ); + } + } + + mrPagePropPanel.ClosePageOrientationPopup(); + return 0; +} + + +} } // end of namespace sw::sidebar + diff --git a/sw/source/ui/sidebar/PageOrientationControl.hxx b/sw/source/ui/sidebar/PageOrientationControl.hxx new file mode 100644 index 000000000000..72b0070b7617 --- /dev/null +++ b/sw/source/ui/sidebar/PageOrientationControl.hxx @@ -0,0 +1,58 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SW_SIDEBAR_PAGE_ORIENTATION_CONTROL_HXX_ +#define _SW_SIDEBAR_PAGE_ORIENTATION_CONTROL_HXX_ + +#include <svx/sidebar/PopupControl.hxx> + +namespace svx { namespace sidebar { + class ValueSetWithTextControl; +} } + +namespace sw { namespace sidebar { + +class PagePropertyPanel; + + +class PageOrientationControl + : public ::svx::sidebar::PopupControl +{ +public: + PageOrientationControl( + Window* pParent, + PagePropertyPanel& rPanel, + const sal_Bool bLandscape ); + ~PageOrientationControl(void); + +private: + ::svx::sidebar::ValueSetWithTextControl* mpOrientationValueSet; + + sal_Bool mbLandscape; + + PagePropertyPanel& mrPagePropPanel; + + DECL_LINK(ImplOrientationHdl, void*); +}; + +} } // end of namespace sw::sidebar + +#endif diff --git a/sw/source/ui/sidebar/PagePropertyPanel.cxx b/sw/source/ui/sidebar/PagePropertyPanel.cxx new file mode 100644 index 000000000000..e329ebd9033c --- /dev/null +++ b/sw/source/ui/sidebar/PagePropertyPanel.cxx @@ -0,0 +1,766 @@ +/************************************************************** +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*************************************************************/ + +#include "precompiled_sw.hxx" + +#include "PagePropertyPanel.hxx" +#include "PagePropertyPanel.hrc" + +#include "PropertyPanel.hrc" + +#include <svx/sidebar/PopupContainer.hxx> +#include "PageOrientationControl.hxx" +#include "PageMarginControl.hxx" +#include "PageSizeControl.hxx" +#include "PageColumnControl.hxx" + +#include <swtypes.hxx> +#include <cmdid.h> +#include <errhdl.hxx> + +#include <svl/intitem.hxx> +#include <editeng/sizeitem.hxx> +#include <editeng/paperinf.hxx> +#include <svx/svxids.hrc> +#include <svx/dlgutil.hxx> +#include <svx/rulritem.hxx> + +#include <sfx2/sidebar/ControlFactory.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/viewsh.hxx> +#include <sfx2/objsh.hxx> + +#include <boost/bind.hpp> + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +#define SetFldVal(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FUNIT_TWIP) + + +namespace sw { namespace sidebar { + +PagePropertyPanel* PagePropertyPanel::Create ( + Window* pParent, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw ::com::sun::star::lang::IllegalArgumentException(A2S("no parent Window given to PagePropertyPanel::Create"), NULL, 0); + if (pBindings == NULL) + throw ::com::sun::star::lang::IllegalArgumentException(A2S("no SfxBindings given to PagePropertyPanel::Create"), NULL, 2); + + return new PagePropertyPanel( + pParent, + pBindings); +} + +PagePropertyPanel::PagePropertyPanel( + Window* pParent, + SfxBindings* pBindings) + : Control(pParent, SW_RES(RID_PROPERTYPANEL_SWPAGE)) + , mpBindings(pBindings) + // visible controls + , maFtOrientation( this, SW_RES(FT_ORIENTATION) ) + , mpToolBoxOrientationBackground( ::sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this) ) + , mpToolBoxOrientation( ::sfx2::sidebar::ControlFactory::CreateToolBox( mpToolBoxOrientationBackground.get(), SW_RES(TB_ORIENTATION)) ) + , maFtMargin( this, SW_RES(FT_MARGIN) ) + , mpToolBoxMarginBackground( ::sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this) ) + , mpToolBoxMargin( ::sfx2::sidebar::ControlFactory::CreateToolBox( mpToolBoxMarginBackground.get(), SW_RES(TB_MARGIN)) ) + , maFtSize( this, SW_RES(FT_SIZE) ) + , mpToolBoxSizeBackground( ::sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this) ) + , mpToolBoxSize( ::sfx2::sidebar::ControlFactory::CreateToolBox( mpToolBoxSizeBackground.get(), SW_RES(TB_SIZE)) ) + , maFtColumn( this, SW_RES(FT_COLUMN) ) + , mpToolBoxColumnBackground( ::sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this) ) + , mpToolBoxColumn( ::sfx2::sidebar::ControlFactory::CreateToolBox( mpToolBoxColumnBackground.get(), SW_RES(TB_COLUMN)) ) + // image resources + , maImgSize (NULL) + , maImgSize_L (NULL) + , mImgPortrait (SW_RES(IMG_PAGE_PORTRAIT)) + , mImgLandscape (SW_RES(IMG_PAGE_LANDSCAPE)) + , mImgNarrow (SW_RES(IMG_PAGE_NARROW)) + , mImgNormal (SW_RES(IMG_PAGE_NORMAL)) + , mImgWide (SW_RES(IMG_PAGE_WIDE)) + , mImgMirrored (SW_RES(IMG_PAGE_MIRRORED)) + , mImgMarginCustom (SW_RES(IMG_PAGE_MARGIN_CUSTOM)) + , mImgNarrow_L (SW_RES(IMG_PAGE_NARROW_L)) + , mImgNormal_L (SW_RES(IMG_PAGE_NORMAL_L)) + , mImgWide_L (SW_RES(IMG_PAGE_WIDE_L)) + , mImgMirrored_L (SW_RES(IMG_PAGE_MIRRORED_L)) + , mImgMarginCustom_L (SW_RES(IMG_PAGE_MARGIN_CUSTOM_L)) + , mImgA3 (SW_RES(IMG_PAGE_A3)) + , mImgA4 (SW_RES(IMG_PAGE_A4)) + , mImgA5 (SW_RES(IMG_PAGE_A5)) + , mImgB4 (SW_RES(IMG_PAGE_B4)) + , mImgB5 (SW_RES(IMG_PAGE_B5)) + , mImgC5 (SW_RES(IMG_PAGE_C5)) + , mImgLetter (SW_RES(IMG_PAGE_LETTER)) + , mImgLegal (SW_RES(IMG_PAGE_LEGAL)) + , mImgSizeNone (SW_RES(IMG_PAGE_SIZE_NONE)) + , mImgA3_L (SW_RES(IMG_PAGE_A3_L)) + , mImgA4_L (SW_RES(IMG_PAGE_A4_L)) + , mImgA5_L (SW_RES(IMG_PAGE_A5_L)) + , mImgB4_L (SW_RES(IMG_PAGE_B4_L)) + , mImgB5_L (SW_RES(IMG_PAGE_B5_L)) + , mImgC5_L (SW_RES(IMG_PAGE_C5_L)) + , mImgLetter_L (SW_RES(IMG_PAGE_LETTER_L)) + , mImgLegal_L (SW_RES(IMG_PAGE_LEGAL_L)) + , mImgSizeNone_L (SW_RES(IMG_PAGE_SIZE_NONE_L)) + , mImgColumn1 (SW_RES(IMG_PAGE_COLUMN_1)) + , mImgColumn2 (SW_RES(IMG_PAGE_COLUMN_2)) + , mImgColumn3 (SW_RES(IMG_PAGE_COLUMN_3)) + , mImgLeft (SW_RES(IMG_PAGE_COLUMN_LEFT)) + , mImgRight (SW_RES(IMG_PAGE_COLUMN_RIGHT)) + , mImgColumnNone (SW_RES(IMG_PAGE_COLUMN_NONE)) + , mImgColumn1_L (SW_RES(IMG_PAGE_COLUMN_1_L)) + , mImgColumn2_L (SW_RES(IMG_PAGE_COLUMN_2_L)) + , mImgColumn3_L (SW_RES(IMG_PAGE_COLUMN_3_L)) + , mImgLeft_L (SW_RES(IMG_PAGE_COLUMN_LEFT_L)) + , mImgRight_L (SW_RES(IMG_PAGE_COLUMN_RIGHT_L)) + , mImgColumnNone_L (SW_RES(IMG_PAGE_COLUMN_NONE_L)) + + , mpPageItem( new SvxPageItem(SID_ATTR_PAGE) ) + , mpPageLRMarginItem( new SvxLongLRSpaceItem( 0, 0, SID_ATTR_PAGE_LRSPACE ) ) + , mpPageULMarginItem( new SvxLongULSpaceItem( 0, 0, SID_ATTR_PAGE_ULSPACE ) ) + , mpPageSizeItem( new SvxSizeItem(SID_ATTR_PAGE_SIZE) ) + , mePaper( PAPER_USER ) + , mpPageColumnTypeItem( new SfxInt16Item(SID_ATTR_PAGE_COLUMN) ) + + , meFUnit() + , meUnit() + + , m_aSwPagePgULControl(SID_ATTR_PAGE_ULSPACE, *pBindings, *this) + , m_aSwPagePgLRControl(SID_ATTR_PAGE_LRSPACE, *pBindings, *this) + , m_aSwPagePgSizeControl(SID_ATTR_PAGE_SIZE, *pBindings, *this) + , m_aSwPagePgControl(SID_ATTR_PAGE, *pBindings, *this) + , m_aSwPageColControl(SID_ATTR_PAGE_COLUMN, *pBindings, *this) + , m_aSwPagePgMetricControl(SID_ATTR_METRIC, *pBindings, *this) + + , mpOrientationPopup() + , mpMarginPopup() + , mpSizePopup() + , mpColumnPopup() + + , mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify( false ) +{ + Initialize(); + mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify = true; + FreeResource(); +} + +PagePropertyPanel::~PagePropertyPanel() +{ + delete[] maImgSize; + delete[] maImgSize_L; + + // destroy the toolbox windows. + mpToolBoxOrientation.reset(); + mpToolBoxMargin.reset(); + mpToolBoxSize.reset(); + mpToolBoxColumn.reset(); + + // destroy the background windows of the toolboxes. + mpToolBoxOrientationBackground.reset(); + mpToolBoxMarginBackground.reset(); + mpToolBoxSizeBackground.reset(); + mpToolBoxColumnBackground.reset(); +} + +void PagePropertyPanel::Initialize() +{ + maFtOrientation.SetBackground(Wallpaper()); + maFtMargin.SetBackground(Wallpaper()); + maFtSize.SetBackground(Wallpaper()); + maFtColumn.SetBackground(Wallpaper()); + + // popup for page orientation + Link aLink = LINK( this, PagePropertyPanel, ClickOrientationHdl ); + mpToolBoxOrientation->SetDropdownClickHdl( aLink ); + mpToolBoxOrientation->SetSelectHdl( aLink ); + mpToolBoxOrientation->SetItemImage( TBI_ORIENTATION, mImgPortrait); + mpToolBoxOrientation->SetItemBits( TBI_ORIENTATION, mpToolBoxOrientation->GetItemBits( TBI_ORIENTATION ) | TIB_DROPDOWNONLY ); + mpToolBoxOrientation->SetQuickHelpText(TBI_ORIENTATION,String(SW_RES(STR_QHELP_TB_ORIENTATION))); + mpToolBoxOrientation->SetOutputSizePixel( mpToolBoxOrientation->CalcWindowSizePixel() ); + mpToolBoxOrientation->SetBackground( Wallpaper() ); + mpToolBoxOrientation->SetPaintTransparent( sal_True ); + + // popup for page margins + aLink = LINK( this, PagePropertyPanel, ClickMarginHdl ); + mpToolBoxMargin->SetDropdownClickHdl( aLink ); + mpToolBoxMargin->SetSelectHdl( aLink ); + mpToolBoxMargin->SetItemImage(TBI_MARGIN, mImgNormal); + mpToolBoxMargin->SetItemBits( TBI_MARGIN, mpToolBoxMargin->GetItemBits( TBI_MARGIN ) | TIB_DROPDOWNONLY ); + mpToolBoxMargin->SetQuickHelpText(TBI_MARGIN,String(SW_RES(STR_QHELP_TB_MARGIN))); + mpToolBoxMargin->SetOutputSizePixel( mpToolBoxMargin->CalcWindowSizePixel() ); + mpToolBoxMargin->SetBackground(Wallpaper()); + mpToolBoxMargin->SetPaintTransparent( sal_True ); + + // popup for page size + aLink = LINK( this, PagePropertyPanel, ClickSizeHdl ); + mpToolBoxSize->SetDropdownClickHdl( aLink ); + mpToolBoxSize->SetSelectHdl( aLink ); + mpToolBoxSize->SetItemImage(TBI_SIZE, mImgLetter); + mpToolBoxSize->SetItemBits( TBI_SIZE, mpToolBoxSize->GetItemBits( TBI_SIZE ) | TIB_DROPDOWNONLY ); + mpToolBoxSize->SetQuickHelpText(TBI_SIZE,String(SW_RES(STR_QHELP_TB_SIZE))); + mpToolBoxSize->SetOutputSizePixel( mpToolBoxSize->CalcWindowSizePixel() ); + mpToolBoxSize->SetBackground(Wallpaper()); + mpToolBoxSize->SetPaintTransparent( sal_True ); + maImgSize = new Image[8]; + maImgSize[0] = mImgA3; + maImgSize[1] = mImgA4; + maImgSize[2] = mImgA5; + maImgSize[3] = mImgB4; + maImgSize[4] = mImgB5; + maImgSize[5] = mImgC5; + maImgSize[6] = mImgLetter; + maImgSize[7] = mImgLegal; + maImgSize_L = new Image[8]; + maImgSize_L[0] = mImgA3_L; + maImgSize_L[1] = mImgA4_L; + maImgSize_L[2] = mImgA5_L; + maImgSize_L[3] = mImgB4_L; + maImgSize_L[4] = mImgB5_L; + maImgSize_L[5] = mImgC5_L; + maImgSize_L[6] = mImgLetter_L; + maImgSize_L[7] = mImgLegal_L; + + // popup for page column property + aLink = LINK( this, PagePropertyPanel, ClickColumnHdl ); + mpToolBoxColumn->SetDropdownClickHdl( aLink ); + mpToolBoxColumn->SetSelectHdl( aLink ); + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn1); + mpToolBoxColumn->SetItemBits( TBI_COLUMN, mpToolBoxColumn->GetItemBits( TBI_COLUMN ) | TIB_DROPDOWNONLY ); + mpToolBoxColumn->SetQuickHelpText(TBI_COLUMN,String(SW_RES(STR_QHELP_TB_COLUMN))); + mpToolBoxColumn->SetOutputSizePixel( mpToolBoxColumn->CalcWindowSizePixel() ); + mpToolBoxColumn->SetBackground(Wallpaper()); + mpToolBoxColumn->SetPaintTransparent( sal_True ); + + meFUnit = GetModuleFieldUnit(); + meUnit = m_aSwPagePgSizeControl.GetCoreMetric(); + + // 'pull' for page style's attribute values + mpBindings->Update( SID_ATTR_PAGE_LRSPACE ); + mpBindings->Update( SID_ATTR_PAGE_ULSPACE ); + mpBindings->Update( SID_ATTR_PAGE ); + mpBindings->Update( SID_ATTR_PAGE_SIZE ); +} + + +::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent ) +{ + return new PageOrientationControl( pParent, *this , mpPageItem->IsLandscape() ); +} + + +IMPL_LINK( PagePropertyPanel, ClickOrientationHdl, ToolBox*, pToolBox ) +{ + if ( ! mpOrientationPopup) + { + mpOrientationPopup.reset( + new ::svx::sidebar::Popup( + this, + ::boost::bind(&PagePropertyPanel::CreatePageOrientationControl, this, _1), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Page orientation")) ) ); + } + mpOrientationPopup->Show( *pToolBox ); + + return 0L; +} + + +void PagePropertyPanel::ExecuteOrientationChange( const sal_Bool bLandscape ) +{ + { + // set new page orientation + mpPageItem->SetLandscape( bLandscape ); + + // swap the width and height of the page size + mpPageSizeItem->SetSize( Size( mpPageSizeItem->GetSize().Height(), mpPageSizeItem->GetSize().Width() ) ); + + // apply changed attributes + GetBindings()->GetDispatcher()->Execute( SID_ATTR_PAGE_SIZE, SFX_CALLMODE_RECORD, mpPageSizeItem.get(), mpPageItem.get(), 0L ); + } + + // check, if margin values still fit to the changed page size. + // if not, adjust margin values + { + const long nML = mpPageLRMarginItem->GetLeft(); + const long nMR = mpPageLRMarginItem->GetRight(); + const long nTmpPW = nML + nMR + MINBODY; + + const long nPW = mpPageSizeItem->GetSize().Width(); + + if ( nTmpPW > nPW ) + { + if ( nML <= nMR ) + { + ExecuteMarginLRChange( mpPageLRMarginItem->GetLeft(), nMR - (nTmpPW - nPW ) ); + } + else + { + ExecuteMarginLRChange( nML - (nTmpPW - nPW ), mpPageLRMarginItem->GetRight() ); + } + } + + const long nMT = mpPageULMarginItem->GetUpper(); + const long nMB = mpPageULMarginItem->GetLower(); + const long nTmpPH = nMT + nMB + MINBODY; + + const long nPH = mpPageSizeItem->GetSize().Height(); + + if ( nTmpPH > nPH ) + { + if ( nMT <= nMB ) + { + ExecuteMarginULChange( mpPageULMarginItem->GetUpper(), nMB - ( nTmpPH - nPH ) ); + } + else + { + ExecuteMarginULChange( nMT - ( nTmpPH - nPH ), mpPageULMarginItem->GetLower() ); + } + } + } +} + + +void PagePropertyPanel::ClosePageOrientationPopup() +{ + mpOrientationPopup->Hide(); +} + + + + +::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent ) +{ + return new PageMarginControl( + pParent, + *this, + *mpPageLRMarginItem.get(), + *mpPageULMarginItem.get(), + mpPageItem->GetPageUsage() == SVX_PAGE_MIRROR, + mpPageSizeItem->GetSize(), + mpPageItem->IsLandscape(), + meFUnit, + meUnit ); +} + + +void PagePropertyPanel::ExecuteMarginLRChange( + const long nPageLeftMargin, + const long nPageRightMargin ) +{ + mpPageLRMarginItem->SetLeft( nPageLeftMargin ); + mpPageLRMarginItem->SetRight( nPageRightMargin ); + GetBindings()->GetDispatcher()->Execute( SID_ATTR_PAGE_LRSPACE, SFX_CALLMODE_RECORD, mpPageLRMarginItem.get(), 0L ); +} + +void PagePropertyPanel::ExecuteMarginULChange( + const long nPageTopMargin, + const long nPageBottomMargin ) +{ + mpPageULMarginItem->SetUpper( nPageTopMargin ); + mpPageULMarginItem->SetLower( nPageBottomMargin ); + GetBindings()->GetDispatcher()->Execute( SID_ATTR_PAGE_ULSPACE, SFX_CALLMODE_RECORD, mpPageULMarginItem.get(), 0L ); +} + + +void PagePropertyPanel::ExecutePageLayoutChange( const bool bMirrored ) +{ + mpPageItem->SetPageUsage( bMirrored ? SVX_PAGE_MIRROR : SVX_PAGE_ALL ); + GetBindings()->GetDispatcher()->Execute( SID_ATTR_PAGE, SFX_CALLMODE_RECORD, mpPageItem.get(), 0L ); +} + + +IMPL_LINK( PagePropertyPanel, ClickMarginHdl, ToolBox*, pToolBox ) +{ + if ( ! mpMarginPopup) + mpMarginPopup.reset( + new ::svx::sidebar::Popup( + this, + ::boost::bind(&PagePropertyPanel::CreatePageMarginControl, this, _1), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Page margins")) ) ); + mpMarginPopup->Show( *pToolBox ); + + return 0L; +} + + +void PagePropertyPanel::ClosePageMarginPopup() +{ + mpMarginPopup->Hide(); +} + + + + +::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent ) +{ + return new PageSizeControl( + pParent, + *this, + mePaper, + mpPageItem->IsLandscape(), + meFUnit ); +} + + +void PagePropertyPanel::ExecuteSizeChange( const Paper ePaper ) +{ + Size aPageSize = SvxPaperInfo::GetPaperSize( ePaper, (MapUnit)(meUnit) ); + if ( mpPageItem->IsLandscape() ) + { + Swap( aPageSize ); + } + mpPageSizeItem->SetSize( aPageSize ); + + mpBindings->GetDispatcher()->Execute(SID_ATTR_PAGE_SIZE, SFX_CALLMODE_RECORD, mpPageSizeItem.get(), 0L ); +} + + +IMPL_LINK( PagePropertyPanel, ClickSizeHdl, ToolBox*, pToolBox ) +{ + if ( ! mpSizePopup) + mpSizePopup.reset( + new ::svx::sidebar::Popup( + this, + ::boost::bind(&PagePropertyPanel::CreatePageSizeControl, this, _1), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Page size")) ) ); + mpSizePopup->Show( *pToolBox ); + + return 0L; +} + + +void PagePropertyPanel::ClosePageSizePopup() +{ + mpSizePopup->Hide(); +} + + + + +::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent ) +{ + return new PageColumnControl( + pParent, + *this, + mpPageColumnTypeItem->GetValue(), + mpPageItem->IsLandscape() ); +} + + +void PagePropertyPanel::ExecuteColumnChange( const sal_uInt16 nColumnType ) +{ + mpPageColumnTypeItem->SetValue( nColumnType ); + mpBindings->GetDispatcher()->Execute(SID_ATTR_PAGE_COLUMN, SFX_CALLMODE_RECORD, mpPageColumnTypeItem.get(), 0L ); +} + + +IMPL_LINK( PagePropertyPanel, ClickColumnHdl, ToolBox*, pToolBox ) +{ + if ( ! mpColumnPopup) + mpColumnPopup.reset( + new ::svx::sidebar::Popup( + this, + ::boost::bind(&PagePropertyPanel::CreatePageColumnControl, this, _1), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Page columns")) ) ); + mpColumnPopup->Show( *pToolBox ); + + return 0L; +} + + +void PagePropertyPanel::ClosePageColumnPopup() +{ + mpColumnPopup->Hide(); +} + + + + +void PagePropertyPanel::NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState) +{ + switch( nSId ) + { + case SID_ATTR_PAGE_COLUMN: + { + if ( eState >= SFX_ITEM_AVAILABLE && + pState && pState->ISA(SfxInt16Item) ) + { + mpPageColumnTypeItem.reset( static_cast<SfxInt16Item*>(pState->Clone()) ); + ChangeColumnImage( mpPageColumnTypeItem->GetValue() ); + } + } + break; + case SID_ATTR_PAGE_LRSPACE: + if ( eState >= SFX_ITEM_AVAILABLE && + pState && pState->ISA(SvxLongLRSpaceItem) ) + { + mpPageLRMarginItem.reset( static_cast<SvxLongLRSpaceItem*>(pState->Clone()) ); + ChangeMarginImage(); + } + break; + + case SID_ATTR_PAGE_ULSPACE: + if ( eState >= SFX_ITEM_AVAILABLE && + pState && pState->ISA(SvxLongULSpaceItem) ) + { + mpPageULMarginItem.reset( static_cast<SvxLongULSpaceItem*>(pState->Clone()) ); + ChangeMarginImage(); + } + break; + + case SID_ATTR_PAGE: + if ( eState >= SFX_ITEM_AVAILABLE && + pState && pState->ISA(SvxPageItem) ) + { + mpPageItem.reset( static_cast<SvxPageItem*>(pState->Clone()) ); + if ( mpPageItem->IsLandscape() ) + { + mpToolBoxOrientation->SetItemImage(TBI_ORIENTATION, mImgLandscape); + } + else + { + mpToolBoxOrientation->SetItemImage(TBI_ORIENTATION, mImgPortrait); + } + ChangeMarginImage(); + ChangeSizeImage(); + ChangeColumnImage( mpPageColumnTypeItem->GetValue() ); + } + break; + + case SID_ATTR_PAGE_SIZE: + if ( mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify ) + { + mpBindings->Invalidate( SID_ATTR_PAGE, sal_True, sal_False ); + } + if ( eState >= SFX_ITEM_AVAILABLE && + pState && pState->ISA(SvxSizeItem) ) + { + mpPageSizeItem.reset( static_cast<SvxSizeItem*>(pState->Clone()) ); + ChangeSizeImage(); + } + break; + case SID_ATTR_METRIC: + MetricState( eState, pState ); + break; + } +} + + +void PagePropertyPanel::MetricState( SfxItemState eState, const SfxPoolItem* pState ) +{ + meFUnit = FUNIT_NONE; + if ( pState && eState >= SFX_ITEM_DEFAULT ) + { + meFUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue(); + } + else + { + SfxViewFrame* pFrame = SfxViewFrame::Current(); + SfxObjectShell* pSh = NULL; + if ( pFrame ) + pSh = pFrame->GetObjectShell(); + if ( pSh ) + { + SfxModule* pModule = pSh->GetModule(); + if ( pModule ) + { + const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); + if ( pItem ) + meFUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); + } + else + { + DBG_ERRORFILE( "<PagePropertyPanel::MetricState(..)>: no module found" ); + } + } + } +} + + + + +void PagePropertyPanel::ChangeMarginImage() +{ + if ( mpPageLRMarginItem.get() == 0 || + mpPageULMarginItem.get() == 0 || + mpPageItem.get() == 0 ) + { + return; + } + + const long cTolerance = 5; + + if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_NARROW_VALUE) <= cTolerance && + abs(mpPageLRMarginItem->GetRight() - SWPAGE_NARROW_VALUE) <= cTolerance && + abs(mpPageULMarginItem->GetUpper() - SWPAGE_NARROW_VALUE) <= cTolerance && + abs(mpPageULMarginItem->GetLower() - SWPAGE_NARROW_VALUE) <= cTolerance && + mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR ) + mpToolBoxMargin->SetItemImage( TBI_MARGIN, mpPageItem->IsLandscape() ? mImgNarrow_L : mImgNarrow ); + + else if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_NORMAL_VALUE) <= cTolerance && + abs(mpPageLRMarginItem->GetRight() - SWPAGE_NORMAL_VALUE) <= cTolerance && + abs(mpPageULMarginItem->GetUpper() - SWPAGE_NORMAL_VALUE) <= cTolerance && + abs(mpPageULMarginItem->GetLower() - SWPAGE_NORMAL_VALUE) <= cTolerance && + mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR ) + mpToolBoxMargin->SetItemImage(TBI_MARGIN, mpPageItem->IsLandscape() ? mImgNormal_L : mImgNormal ); + + else if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_WIDE_VALUE2) <= cTolerance && + abs(mpPageLRMarginItem->GetRight() - SWPAGE_WIDE_VALUE2) <= cTolerance && + abs(mpPageULMarginItem->GetUpper() - SWPAGE_WIDE_VALUE1) <= cTolerance && + abs(mpPageULMarginItem->GetLower() - SWPAGE_WIDE_VALUE1) <= cTolerance && + mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR ) + mpToolBoxMargin->SetItemImage(TBI_MARGIN, mpPageItem->IsLandscape() ? mImgWide_L : mImgWide ); + + else if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_WIDE_VALUE3) <= cTolerance && + abs(mpPageLRMarginItem->GetRight() - SWPAGE_WIDE_VALUE1) <= cTolerance && + abs(mpPageULMarginItem->GetUpper() - SWPAGE_WIDE_VALUE1) <= cTolerance && + abs(mpPageULMarginItem->GetLower() - SWPAGE_WIDE_VALUE1) <= cTolerance && + mpPageItem->GetPageUsage() == SVX_PAGE_MIRROR ) + mpToolBoxMargin->SetItemImage(TBI_MARGIN, mpPageItem->IsLandscape() ? mImgMirrored_L : mImgMirrored ); + + else + mpToolBoxMargin->SetItemImage(TBI_MARGIN, mpPageItem->IsLandscape() ? mImgMarginCustom_L : mImgMarginCustom ); +} + + +void PagePropertyPanel::ChangeSizeImage() +{ + if ( mpPageSizeItem.get() == 0 || + mpPageItem.get() == 0 ) + { + return; + } + + Size aTmpPaperSize = mpPageSizeItem->GetSize(); + if ( mpPageItem->IsLandscape() ) + { + Swap( aTmpPaperSize ); // Swap(..) defined in editeng/paperinf.hxx + } + + mePaper = SvxPaperInfo::GetSvxPaper( aTmpPaperSize, static_cast<MapUnit>(meUnit), sal_True ); + + sal_uInt16 nImageIdx = 0; + switch ( mePaper ) + { + case PAPER_A3: + nImageIdx = 1; + break; + case PAPER_A4: + nImageIdx = 2; + break; + case PAPER_A5: + nImageIdx = 3; + break; + case PAPER_B4_ISO: + nImageIdx = 4; + break; + case PAPER_B5_ISO: + nImageIdx = 5; + break; + case PAPER_ENV_C5: + nImageIdx = 6; + break; + case PAPER_LETTER: + nImageIdx = 7; + break; + case PAPER_LEGAL: + nImageIdx = 8; + break; + default: + nImageIdx = 0; + mePaper = PAPER_USER; + break; + } + + if ( nImageIdx == 0 ) + { + mpToolBoxSize->SetItemImage( TBI_SIZE, + ( mpPageItem->IsLandscape() ? mImgSizeNone_L : mImgSizeNone ) ); + } + else + { + mpToolBoxSize->SetItemImage( TBI_SIZE, + ( mpPageItem->IsLandscape() ? maImgSize_L[nImageIdx-1] : maImgSize[nImageIdx-1] ) ); + } +} + + +void PagePropertyPanel::ChangeColumnImage( const sal_uInt16 nColumnType ) +{ + if ( mpPageItem.get() == 0 ) + { + return; + } + + if ( !mpPageItem->IsLandscape() ) + { + switch( nColumnType ) + { + case 1: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn1); + break; + case 2: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn2); + break; + case 3: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn3); + break; + case 4: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgLeft); + break; + case 5: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgRight); + break; + default: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumnNone); + } + } + else + { + switch( nColumnType ) + { + case 1: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn1_L); + break; + case 2: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn2_L); + break; + case 3: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn3_L); + break; + case 4: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgLeft_L); + break; + case 5: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgRight_L); + break; + default: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumnNone_L); + } + } +} + +} } // end of namespace ::sw::sidebar diff --git a/sw/source/ui/sidebar/PagePropertyPanel.hrc b/sw/source/ui/sidebar/PagePropertyPanel.hrc new file mode 100644 index 000000000000..b719dfce1206 --- /dev/null +++ b/sw/source/ui/sidebar/PagePropertyPanel.hrc @@ -0,0 +1,200 @@ +/************************************************************** +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*************************************************************/ + +#include "PropertyPanel.hrc" + +#define FT_ORIENTATION 1 +#define TB_ORIENTATION 2 +#define FT_MARGIN 3 +#define TB_MARGIN 4 +#define FT_SIZE 5 +#define TB_SIZE 6 +#define FT_COLUMN 7 +#define TB_COLUMN 8 +#define TBI_MARGIN 9 +#define IMG_PORTRAIT 10 +#define IMG_LANDSCAPE 11 +#define STR_PORTRAIT 12 +#define STR_LANDSCAPE 13 +#define ED_SWPAPER_WIDTH 14 +#define ED_SWPAPER_HEIGHT 15 +#define LB_SWPAPER_TRAY 16 +#define LB_SWPAPER_SIZE 17 +#define MF_SWLEFT_MARGIN 18 +#define MF_SWRIGHT_MARGIN 19 +#define MF_SWTOP_MARGIN 20 +#define MF_SWBOTTOM_MARGIN 21 +#define TBI_SIZE 22 +#define VS_SIZE 23 +#define STR_LCVALUE 24 +#define FT_CUSTOM 25 +#define FLD_WIDTH_HEIGHT 26 + +#define TBI_ORIENTATION 28 +#define VS_ORIENTATION 29 +#define IMG_PAGE_PORTRAIT 30 +#define IMG_PAGE_LANDSCAPE 31 +#define IMG_NARROW 32 +#define IMG_NORMAL 33 +#define IMG_WIDE 34 +#define IMG_MIRRORED 35 +#define STR_NARROW 36 +#define STR_NORMAL 37 +#define STR_WIDE 38 +#define STR_MIRRORED 39 +#define VS_MARGIN 40 +#define IMG_CUSTOM 41 +#define FT_LEFT 42 +#define FT_RIGHT 43 +#define FT_TOP 44 +#define FT_BOTTOM 45 +#define FT_INNER 46 +#define FT_OUTER 47 +#define TBI_COLUMN 48 +#define VS_COLUMN 49 +#define MBOX_WIDTH 50 +#define IMG_ONE 51 +#define IMG_TWO 52 +#define IMG_THREE 53 +#define IMG_LEFT 54 +#define IMG_RIGHT 55 +#define STR_ONE 56 +#define STR_TWO 57 +#define STR_THREE 58 +#define STR_LEFT 59 +#define STR_RIGHT 60 +#define CB_COLUMN_MORE 61 + +#define CB_SIZE_MORE 61 + +#define IMG_PAGE_NARROW 64 +#define IMG_PAGE_NORMAL 65 +#define IMG_PAGE_WIDE 63 +#define IMG_PAGE_MIRRORED 67 +#define IMG_PAGE_MARGIN_CUSTOM 68 +#define IMG_PAGE_A3 69 +#define IMG_PAGE_A4 70 +#define IMG_PAGE_A5 71 +#define IMG_PAGE_B4 72 +#define IMG_PAGE_B5 73 +#define IMG_PAGE_C5 74 +#define IMG_PAGE_LETTER 75 +#define IMG_PAGE_LEGAL 76 +#define IMG_PAGE_COLUMN_1 77 +#define IMG_PAGE_COLUMN_2 78 +#define IMG_PAGE_COLUMN_3 79 +#define IMG_PAGE_COLUMN_LEFT 80 +#define IMG_PAGE_COLUMN_RIGHT 81 +#define IMG_PAGE_SIZE_NONE 82 +#define IMG_PAGE_COLUMN_NONE 83 +#define IMG_PAGE_COLUMN_1_L 84 +#define IMG_PAGE_COLUMN_2_L 85 +#define IMG_PAGE_COLUMN_3_L 86 +#define IMG_PAGE_COLUMN_LEFT_L 87 +#define IMG_PAGE_COLUMN_RIGHT_L 88 +#define IMG_PAGE_COLUMN_NONE_L 89 +#define IMG_ONE_L 90 +#define IMG_TWO_L 91 +#define IMG_THREE_L 92 +#define IMG_LEFT_L 93 +#define IMG_RIGHT_L 94 +#define IMG_PAGE_A3_L 95 +#define IMG_PAGE_A4_L 96 +#define IMG_PAGE_A5_L 97 +#define IMG_PAGE_B4_L 98 +#define IMG_PAGE_B5_L 99 +#define IMG_PAGE_C5_L 100 +#define IMG_PAGE_LETTER_L 101 +#define IMG_PAGE_LEGAL_L 102 +#define IMG_PAGE_SIZE_NONE_L 103 +#define IMG_PAGE_NARROW_L 104 +#define IMG_PAGE_NORMAL_L 105 +#define IMG_PAGE_WIDE_L 106 +#define IMG_PAGE_MIRRORED_L 107 +#define IMG_PAGE_MARGIN_CUSTOM_L 108 +#define IMG_NARROW_L 109 +#define IMG_NORMAL_L 110 +#define IMG_WIDE_L 111 +#define IMG_MIRRORED_L 112 +#define FLD_LEFT_MARGIN 113 +#define FLD_RIGHT_MARGIN 114 +#define FLD_TOP_MARGIN 115 +#define FLD_BOTTOM_MARGIN 116 + +#define STR_QHELP_TB_ORIENTATION 117 +#define STR_QHELP_TB_MARGIN 118 +#define STR_QHELP_TB_SIZE 119 +#define STR_QHELP_TB_COLUMN 120 +#define IMG_CUSTOM_DIS 121 +// +#define STR_MARGIN_TOOLTIP_LEFT 122 +#define STR_MARGIN_TOOLTIP_RIGHT 123 +#define STR_MARGIN_TOOLTIP_INNER 124 +#define STR_MARGIN_TOOLTIP_OUTER 125 +#define STR_MARGIN_TOOLTIP_TOP 126 +#define STR_MARGIN_TOOLTIP_BOT 127 + +#define POPUP_MARGIN 4 +#define VS_WIDTH 78 +#define ITEM_HEIGHT 17 +#define ITEM_HEIGHT2 15 + +//========================================Position============================================== + +#define FT_ORIENTATION_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_ORIENTATION_Y SECTIONPAGE_MARGIN_VERTICAL_TOP +#define TBX_ORIENTATION_X FT_ORIENTATION_X +#define TBX_ORIENTATION_Y FT_ORIENTATION_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL +#define FT_MARGIN_X FT_ORIENTATION_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL +#define FT_MARGIN_Y FT_ORIENTATION_Y +#define TBX_MARGIN_X FT_MARGIN_X +#define TBX_MARGIN_Y TBX_ORIENTATION_Y +#define FT_SIZE_X FT_ORIENTATION_X +#define FT_SIZE_Y TBX_ORIENTATION_Y + 20 + CONTROL_SPACING_VERTICAL +#define TBX_SIZE_X FT_SIZE_X +#define TBX_SIZE_Y FT_SIZE_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL +#define FT_COLUMN_X FT_MARGIN_X +#define FT_COLUMN_Y FT_SIZE_Y +#define TBX_COLUMN_X FT_COLUMN_X +#define TBX_COLUMN_Y TBX_SIZE_Y + +#define FT_CUSTOM_X POPUP_MARGIN + OFFSET_X +#define FT_CUSTOM_Y POPUPPANEL_MARGIN_SMALL * 2 + ITEM_HEIGHT * 5 + +#define POP_BORDER_X POPUP_MARGIN + OFFSET_X + 1 +#define POP_BORDER_Y POPUPPANEL_MARGIN_SMALL * 3 + ITEM_HEIGHT * 5 + TEXT_HEIGHT +#define BD_WIDTH VS_WIDTH - 6 +#define BD_HEIGHT MBOX_HEIGHT*4 + CONTROL_SPACING_VERTICAL*5 + +#define FT_X POP_BORDER_X + CONTROL_SPACING_HORIZONTAL +#define MF_X FT_X + 25 + CONTROL_SPACING_HORIZONTAL +#define LEFT_MF_Y POP_BORDER_Y + CONTROL_SPACING_VERTICAL +#define RIGHT_MF_Y LEFT_MF_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define TOP_MF_Y RIGHT_MF_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define BOTTOM_MF_Y TOP_MF_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define FT_LEFT_Y LEFT_MF_Y + 1 +#define FT_RIGHT_Y RIGHT_MF_Y + 1 +#define FT_TOP_Y TOP_MF_Y + 1 +#define FT_BOTTOM_Y BOTTOM_MF_Y + 1 + +#define MARGIN_PANEL_HEIGHT POP_BORDER_Y + BD_HEIGHT + POPUP_MARGIN + OFFSET_Y +#define CUST_MORE_BUTTON_IMG_OFF_X POPUPPANEL_MARGIN_HORIZONTAL + OFFSET_X +#define PAGE_HEIGHT TBX_COLUMN_Y + 20 + SECTIONPAGE_MARGIN_VERTICAL_BOT
\ No newline at end of file diff --git a/sw/source/ui/sidebar/PagePropertyPanel.hxx b/sw/source/ui/sidebar/PagePropertyPanel.hxx new file mode 100644 index 000000000000..912988ba233f --- /dev/null +++ b/sw/source/ui/sidebar/PagePropertyPanel.hxx @@ -0,0 +1,223 @@ +/************************************************************** +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*************************************************************/ + +#ifndef SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX +#define SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX + +#include <svx/sidebar/Popup.hxx> + +#include <sfx2/sidebar/ControllerItem.hxx> + +namespace svx { namespace sidebar { + class PopupControl; +} } + +#include <i18npool/paper.hxx> + +#include <svx/pageitem.hxx> +#include <svx/rulritem.hxx> +#include <editeng/sizeitem.hxx> + +#include <vcl/ctrl.hxx> +#include <vcl/fixed.hxx> +#include <vcl/button.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/field.hxx> +#include <svl/intitem.hxx> + +#include <boost/scoped_ptr.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +namespace sw { namespace sidebar { + + class PagePropertyPanel + : public Control, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface + { + public: + static PagePropertyPanel* Create( + Window* pParent, + SfxBindings* pBindings ); + + // interface of ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState ); + + SfxBindings* GetBindings() const + { + return mpBindings; + } + + + ::svx::sidebar::PopupControl* CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent ); + void ExecuteOrientationChange( const sal_Bool bLandscape ); + void ClosePageOrientationPopup(); + + ::svx::sidebar::PopupControl* CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent ); + void ExecuteMarginLRChange( + const long nPageLeftMargin, + const long nPageRightMargin ); + void ExecuteMarginULChange( + const long nPageTopMargin, + const long nPageBottomMargin ); + void ExecutePageLayoutChange( const bool bMirrored ); + void ClosePageMarginPopup(); + + ::svx::sidebar::PopupControl* CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent ); + void ExecuteSizeChange( const Paper ePaper ); + void ClosePageSizePopup(); + + ::svx::sidebar::PopupControl* CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent ); + void ExecuteColumnChange( const sal_uInt16 nColumnType ); + void ClosePageColumnPopup(); + + private: + PagePropertyPanel( + Window* pParent, + SfxBindings* pBindings ); + virtual ~PagePropertyPanel(void); + + SfxBindings* mpBindings; + + // toolboxes - on click open corresponding popup + FixedText maFtOrientation; + ::boost::scoped_ptr<Window> mpToolBoxOrientationBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxOrientation; + FixedText maFtMargin; + ::boost::scoped_ptr<Window> mpToolBoxMarginBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxMargin; + FixedText maFtSize; + ::boost::scoped_ptr<Window> mpToolBoxSizeBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxSize; + FixedText maFtColumn; + ::boost::scoped_ptr<Window> mpToolBoxColumnBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxColumn; + + Image* maImgSize; + Image* maImgSize_L; + Image mImgPortrait; + Image mImgLandscape; + Image mImgNarrow; + Image mImgNormal; + Image mImgWide; + Image mImgMirrored; + Image mImgMarginCustom; + Image mImgNarrow_L; + Image mImgNormal_L; + Image mImgWide_L; + Image mImgMirrored_L; + Image mImgMarginCustom_L; + Image mImgA3; + Image mImgA4; + Image mImgA5; + Image mImgB4; + Image mImgB5; + Image mImgC5; + Image mImgLetter; + Image mImgLegal; + Image mImgSizeNone; + Image mImgA3_L; + Image mImgA4_L; + Image mImgA5_L; + Image mImgB4_L; + Image mImgB5_L; + Image mImgC5_L; + Image mImgLetter_L; + Image mImgLegal_L; + Image mImgSizeNone_L; + Image mImgColumn1; + Image mImgColumn2; + Image mImgColumn3; + Image mImgLeft; + Image mImgRight; + Image mImgColumnNone; + Image mImgColumn1_L; + Image mImgColumn2_L; + Image mImgColumn3_L; + Image mImgLeft_L; + Image mImgRight_L; + Image mImgColumnNone_L; + + // item keeping the following page style attributes: + // - page orientation + // - page usage - only left, only right, both, mirrored + // item also hold the numbering type for the page style which should + // be kept stable. + ::boost::scoped_ptr<SvxPageItem> mpPageItem; + + // item keeping the page style's left and right margins + ::boost::scoped_ptr<SvxLongLRSpaceItem> mpPageLRMarginItem; + // item keeping the page style's top and bottom margins + ::boost::scoped_ptr<SvxLongULSpaceItem> mpPageULMarginItem; + + // item keeping the page style's page size + ::boost::scoped_ptr<SvxSizeItem> mpPageSizeItem; + // Paper corresponding to the page style's page size + Paper mePaper; + + // item keeping the page column type + ::boost::scoped_ptr<SfxInt16Item> mpPageColumnTypeItem; + + FieldUnit meFUnit; + SfxMapUnit meUnit; + + // controller items + ::sfx2::sidebar::ControllerItem m_aSwPagePgULControl; + ::sfx2::sidebar::ControllerItem m_aSwPagePgLRControl; + ::sfx2::sidebar::ControllerItem m_aSwPagePgSizeControl; + ::sfx2::sidebar::ControllerItem m_aSwPagePgControl; + ::sfx2::sidebar::ControllerItem m_aSwPageColControl; + ::sfx2::sidebar::ControllerItem m_aSwPagePgMetricControl; + + // popups + ::boost::scoped_ptr< ::svx::sidebar::Popup > mpOrientationPopup; + ::boost::scoped_ptr< ::svx::sidebar::Popup > mpMarginPopup; + ::boost::scoped_ptr< ::svx::sidebar::Popup > mpSizePopup; + ::boost::scoped_ptr< ::svx::sidebar::Popup > mpColumnPopup; + + bool mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify; + + // handler for popup toolboxes to show the popups + DECL_LINK(ClickOrientationHdl, ToolBox* ); + DECL_LINK(ClickMarginHdl, ToolBox* ); + DECL_LINK(ClickSizeHdl, ToolBox* ); + DECL_LINK(ClickColumnHdl, ToolBox* ); + + void Initialize(); + + void MetricState( SfxItemState eState, const SfxPoolItem* pState ); + + // helper to adjust popup toolbox' images + void ChangeMarginImage(); + void ChangeSizeImage(); + void ChangeColumnImage( const sal_uInt16 nColumnType ); + + }; + +} } // end of namespace ::sw::sidebar + +#endif diff --git a/sw/source/ui/sidebar/PagePropertyPanel.src b/sw/source/ui/sidebar/PagePropertyPanel.src new file mode 100644 index 000000000000..c9e3ade902c3 --- /dev/null +++ b/sw/source/ui/sidebar/PagePropertyPanel.src @@ -0,0 +1,698 @@ +/************************************************************** +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*************************************************************/ + +#include <sfx2/sidebar/propertypanel.hrc> +#include "PropertyPanel.hrc" +#include "PagePropertyPanel.hrc" +#include "helpid.h" + +// page property panel control +Control RID_PROPERTYPANEL_SWPAGE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PAGE_HEIGHT ); + HelpID = HID_PROPERTYPANEL_SWPAGE_SECTION; + Text = "Page"; + + FixedText FT_ORIENTATION + { + Pos = MAP_APPFONT ( FT_ORIENTATION_X, FT_ORIENTATION_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, TEXT_HEIGHT) ; + Text [ en-US ] = "~Orientation:"; + }; + ToolBox TB_ORIENTATION + { + Pos = MAP_APPFONT (TBX_ORIENTATION_X, TBX_ORIENTATION_Y) ; + HelpID = HID_SWPAGE_ORIENTATION; + SVLook = TRUE ; + TabStop = TRUE ; + Text = "Orientation" ; + ItemList = + { + ToolBoxItem + { + HelpID = HID_SWPAGE_TBI_ORIENTATION; + Identifier = TBI_ORIENTATION ; + Text [ en-US ] = "Orientation" ; + DropDown = TRUE ; + }; + }; + }; + String STR_QHELP_TB_ORIENTATION + { + Text [ en-US ] = "Select the paper orientation - vertically (portrait) or horizontally (landscape) - for the current page style."; + }; + + FixedText FT_MARGIN + { + Pos = MAP_APPFONT ( FT_MARGIN_X, FT_MARGIN_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH + 50, TEXT_HEIGHT) ; + Text [ en-US ] = "~Margin:"; + }; + ToolBox TB_MARGIN + { + SVLook = TRUE ; + Pos = MAP_APPFONT (TBX_MARGIN_X, TBX_MARGIN_Y) ; + HelpID = HID_SWPAGE_MARGIN; + TabStop = TRUE ; + Text = "Margin" ; + ItemList = + { + ToolBoxItem + { + HelpID = HID_SWPAGE_TBI_MARGIN; + Identifier = TBI_MARGIN ; + Text [ en-US ] = "Margin" ; + DropDown = TRUE ; + }; + }; + }; + String STR_QHELP_TB_MARGIN + { + Text [ en-US ] = "Select the margin values for the current page style."; + }; + + FixedText FT_SIZE + { + Pos = MAP_APPFONT ( FT_SIZE_X, FT_SIZE_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, TEXT_HEIGHT) ; + Text [ en-US ] = "~Size:"; + }; + ToolBox TB_SIZE + { + SVLook = TRUE ; + Pos = MAP_APPFONT ( TBX_SIZE_X , TBX_SIZE_Y ) ; + HelpID = HID_SWPAGE_SIZE; + TabStop = TRUE ; + Text = "Size" ; + ItemList = + { + ToolBoxItem + { + HelpID = HID_SWPAGE_TBI_SIZE; + Identifier = TBI_SIZE ; + Text [ en-US ] = "Size" ; + DropDown = TRUE ; + }; + }; + }; + String STR_QHELP_TB_SIZE + { + Text [ en-US ] = "Select a predefined paper size for the current page style."; + }; + + FixedText FT_COLUMN + { + Pos = MAP_APPFONT ( FT_COLUMN_X, FT_COLUMN_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH + 50, TEXT_HEIGHT) ; + Text [ en-US ] = "~Column:"; + }; + ToolBox TB_COLUMN + { + SVLook = TRUE ; + Pos = MAP_APPFONT ( TBX_COLUMN_X , TBX_COLUMN_Y ) ; + HelpID = HID_SWPAGE_COLUMN; + TabStop = TRUE ; + Text = "Column" ; + ItemList = + { + ToolBoxItem + { + HelpID = HID_SWPAGE_TBI_COLUMN; + Identifier = TBI_COLUMN; + Text [ en-US ] = "Column" ; + DropDown = TRUE ; + }; + }; + }; + String STR_QHELP_TB_COLUMN + { + Text [ en-US ] = "Select the layout and the number of columns for the current page style."; + }; + + Image IMG_PAGE_PORTRAIT + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/portraitcopy_24x24.png";}; + }; + Image IMG_PAGE_LANDSCAPE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/Landscapecopy_24x24.png";}; + }; + Image IMG_PAGE_NARROW + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_narrow_24x24.png";}; + }; + Image IMG_PAGE_NORMAL + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_nomal_24x24.png";}; + }; + Image IMG_PAGE_WIDE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_wide_24x24.png";}; + }; + Image IMG_PAGE_MIRRORED + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_mirror_24x24.png";}; + }; + Image IMG_PAGE_MARGIN_CUSTOM + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_copy_24x24.png";}; + }; + Image IMG_PAGE_NARROW_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnarrow_24x24.png";}; + }; + Image IMG_PAGE_NORMAL_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnormal_24x24.png";}; + }; + Image IMG_PAGE_WIDE_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatwide_24x24.png";}; + }; + Image IMG_PAGE_MIRRORED_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatmirror_24x24.png";}; + }; + Image IMG_PAGE_MARGIN_CUSTOM_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatcopy_24x24.png";}; + }; + Image IMG_PAGE_A3 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_A3_24x24.png";}; + }; + Image IMG_PAGE_A4 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_A4_24x24.png";}; + }; + Image IMG_PAGE_A5 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_A5_24x24.png";}; + }; + Image IMG_PAGE_B4 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_B4_24x24.png";}; + }; + Image IMG_PAGE_B5 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_B5_24x24.png";}; + }; + Image IMG_PAGE_C5 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_C5_24x24.png";}; + }; + Image IMG_PAGE_LETTER + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_copy_24x24.png";}; + }; + Image IMG_PAGE_LEGAL + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_copy_24x24.png";}; + }; + Image IMG_PAGE_SIZE_NONE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_copy_24x24.png";}; + }; + Image IMG_PAGE_A3_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeA3_24x24.png";}; + }; + Image IMG_PAGE_A4_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeA4_24x24.png";}; + }; + Image IMG_PAGE_A5_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeA5_24x24.png";}; + }; + Image IMG_PAGE_B4_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeB4_24x24.png";}; + }; + Image IMG_PAGE_B5_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeB5_24x24.png";}; + }; + Image IMG_PAGE_C5_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeC5_24x24.png";}; + }; + Image IMG_PAGE_LETTER_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizecopy_24x24.png";}; + }; + Image IMG_PAGE_LEGAL_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizecopy_24x24.png";}; + }; + Image IMG_PAGE_SIZE_NONE_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizecopy_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_1 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_1_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_2 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_2_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_3 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_3_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_LEFT + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_left_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_RIGHT + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_right_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_NONE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_copy_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_1_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column1_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_2_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column2_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_3_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column3_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_LEFT_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columnleft_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_RIGHT_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columnright_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_NONE_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columncopy_24x24.png";}; + }; +}; + +// popup for page orientation attribute +Control RID_POPUP_SWPAGE_ORIENTATION +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH, ITEM_HEIGHT*2 + POPUPPANEL_MARGIN_SMALL*2 ); + + Control VS_ORIENTATION + { + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y); + Size = MAP_APPFONT ( VS_WIDTH , ITEM_HEIGHT*2); + HelpID = HID_SWPAGE_VS_ORIENTATION; + TabStop = TRUE ; + Text = "Orientation"; + }; + Image IMG_PORTRAIT + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/portraitcopy_24x24.png";}; + }; + Image IMG_LANDSCAPE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/Landscapecopy_24x24.png";}; + }; + String STR_PORTRAIT + { + Text [ en-US ] = "Portrait"; + }; + String STR_LANDSCAPE + { + Text [ en-US ] = "Landscape"; + }; +}; + +// popup for page style's margin attributes +Control RID_POPUP_SWPAGE_MARGIN +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH, MARGIN_PANEL_HEIGHT ); + + Control VS_MARGIN + { + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( VS_WIDTH , ITEM_HEIGHT*5); + HelpID = HID_SWPAGE_VS_MARGIN; + TabStop = TRUE ; + Text = "Margin"; + }; + FixedText FT_CUSTOM + { + Pos = MAP_APPFONT ( FT_CUSTOM_X, FT_CUSTOM_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH + 30, TEXT_HEIGHT) ; + Text [ en-US ] = "Custom:"; + }; + FixedText FT_LEFT + { + Pos = MAP_APPFONT ( FT_X, FT_LEFT_Y ); + Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; + Text [ en-US ] = "~Left:"; + }; + FixedText FT_INNER + { + Pos = MAP_APPFONT ( FT_X, FT_LEFT_Y ); + Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; + Text [ en-US ] = "I~nner:"; + }; + MetricField MF_SWLEFT_MARGIN + { + Border = TRUE; + Pos = MAP_APPFONT ( MF_X , LEFT_MF_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT ); + HelpID = HID_SWPAGE_LEFT_MARGIN; + Left = TRUE; + Repeat = TRUE; + Spin = TRUE; + Maximum = 9999; + DecimalDigits = 2; + Unit = FUNIT_CM; + Last = 9999; + SpinSize = 10; + }; + FixedText FT_RIGHT + { + Pos = MAP_APPFONT ( FT_X, FT_RIGHT_Y ); + Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; + Text [ en-US ] = "~Right:"; + }; + FixedText FT_OUTER + { + Pos = MAP_APPFONT ( FT_X, FT_RIGHT_Y ); + Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; + Text [ en-US ] = "O~uter:"; + }; + MetricField MF_SWRIGHT_MARGIN + { + Border = TRUE; + Pos = MAP_APPFONT ( MF_X , RIGHT_MF_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT ); + HelpID = HID_SWPAGE_RIGHT_MARGIN; + Left = TRUE; + Repeat = TRUE; + Spin = TRUE; + Maximum = 9999; + DecimalDigits = 2; + Unit = FUNIT_CM; + Last = 9999; + SpinSize = 10; + }; + FixedText FT_TOP + { + Pos = MAP_APPFONT ( FT_X, FT_TOP_Y ); + Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; + Text [ en-US ] = "~Top:"; + }; + MetricField MF_SWTOP_MARGIN + { + Border = TRUE; + Pos = MAP_APPFONT ( MF_X , TOP_MF_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT ); + HelpID = HID_SWPAGE_TOP_MARGIN; + Left = TRUE; + Repeat = TRUE; + Spin = TRUE; + Maximum = 9999; + DecimalDigits = 2; + Unit = FUNIT_CM; + Last = 9999; + SpinSize = 10; + }; + FixedText FT_BOTTOM + { + Pos = MAP_APPFONT ( FT_X, FT_BOTTOM_Y ); + Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; + Text [ en-US ] = "~Bottom:"; + }; + MetricField MF_SWBOTTOM_MARGIN + { + Border = TRUE; + Pos = MAP_APPFONT ( MF_X , BOTTOM_MF_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT ); + HelpID = HID_SWPAGE_BOTTOM_MARGIN; + Left = TRUE; + Repeat = TRUE; + Spin = TRUE; + Maximum = 9999; + DecimalDigits = 2; + Unit = FUNIT_CM; + Last = 9999; + SpinSize = 10; + }; + MetricField FLD_WIDTH_HEIGHT + { + Border = TRUE; + Left = TRUE; + Repeat = TRUE; + Spin = TRUE; + Maximum = 9999; + DecimalDigits = 2; + Unit = FUNIT_CM; + Last = 9999; + SpinSize = 10; + }; + + Image IMG_NARROW + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_narrow_24x24.png";}; + }; + Image IMG_NORMAL + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_nomal_24x24.png";}; + }; + Image IMG_WIDE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_wide_24x24.png";}; + }; + Image IMG_MIRRORED + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_mirror_24x24.png";}; + }; + Image IMG_NARROW_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnarrow_24x24.png";}; + }; + Image IMG_NORMAL_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnormal_24x24.png";}; + }; + Image IMG_WIDE_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatwide_24x24.png";}; + }; + Image IMG_MIRRORED_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatmirror_24x24.png";}; + }; + Image IMG_CUSTOM + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/last_custom_common.png";}; + }; + Image IMG_CUSTOM_DIS + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/last_custom_common_grey.png";}; + }; + String STR_LCVALUE + { + Text [ en-US ] = "Last Custom Values"; + }; + String STR_NARROW + { + Text [ en-US ] = "Narrow"; + }; + String STR_NORMAL + { + Text [ en-US ] = "Normal"; + }; + String STR_WIDE + { + Text [ en-US ] = "Wide"; + }; + String STR_MIRRORED + { + Text [ en-US ] = "Mirrored"; + }; + String STR_MARGIN_TOOLTIP_LEFT + { + Text [ en-US ] = "Left: "; + }; + String STR_MARGIN_TOOLTIP_RIGHT + { + Text [ en-US ] = ". Right: "; + }; + String STR_MARGIN_TOOLTIP_INNER + { + Text [ en-US ] = "Inner: "; + }; + String STR_MARGIN_TOOLTIP_OUTER + { + Text [ en-US ] = ". Outer: "; + }; + String STR_MARGIN_TOOLTIP_TOP + { + Text [ en-US ] = ". Top: "; + }; + String STR_MARGIN_TOOLTIP_BOT + { + Text [ en-US ] = ". Bottom: "; + }; +}; + +// popup for page style's page size +Control RID_POPUP_SWPAGE_SIZE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH + 22, ITEM_HEIGHT2*8 + POPUPPANEL_MARGIN_SMALL*2 + CONTROL_SPACING_VERTICAL + 15 ); + + Control VS_SIZE + { + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y); + Size = MAP_APPFONT ( VS_WIDTH + 22 , ITEM_HEIGHT2*8); + HelpID = HID_SWPAGE_VS_SIZE; + TabStop = TRUE ; + Text = "Size"; + }; + PushButton CB_SIZE_MORE + { + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + 2*OFFSET_X, POPUPPANEL_MARGIN_SMALL + 2*OFFSET_Y + ITEM_HEIGHT2*8 ) ; + Size = MAP_APPFONT ( VS_WIDTH - 2 + 22, 15 ) ; + HelpID = HID_SWPAGE_SIZE_MORE; + TabStop = TRUE ; + Text [ en-US ] = "~More Options"; + QuickHelpText [ en-US ] = "More Options" ; + }; + MetricField FLD_WIDTH_HEIGHT + { + Border = TRUE; + Left = TRUE; + Repeat = TRUE; + Spin = TRUE; + Maximum = 9999; + DecimalDigits = 2; + Unit = FUNIT_CM; + Last = 9999; + SpinSize = 10; + }; +}; + +// popup for page style's column attribute +Control RID_POPUP_SWPAGE_COLUMN +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH - 15, ITEM_HEIGHT*5 + POPUPPANEL_MARGIN_SMALL*2 + CONTROL_SPACING_VERTICAL + 15 ); + + Control VS_COLUMN + { + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y); + Size = MAP_APPFONT ( VS_WIDTH -15 , ITEM_HEIGHT*5); + HelpID = HID_SWPAGE_VS_COLUMN; + TabStop = TRUE ; + Text = "Column"; + }; + PushButton CB_COLUMN_MORE + { + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + 2*OFFSET_X, POPUPPANEL_MARGIN_SMALL + 2*OFFSET_Y + ITEM_HEIGHT*5 ) ; + Size = MAP_APPFONT ( VS_WIDTH - 2 - 15, 15 ) ; + HelpID = HID_SWPAGE_COLUMN_MORE; + TabStop = TRUE ; + Text [ en-US ] = "~More Options"; + QuickHelpText [ en-US ] = "More Options" ; + }; + Image IMG_ONE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_1_24x24.png";}; + }; + Image IMG_TWO + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_2_24x24.png";}; + }; + Image IMG_THREE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_3_24x24.png";}; + }; + Image IMG_LEFT + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_left_24x24.png";}; + }; + Image IMG_RIGHT + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_right_24x24.png";}; + }; + Image IMG_ONE_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column1_24x24.png";}; + }; + Image IMG_TWO_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column2_24x24.png";}; + }; + Image IMG_THREE_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column3_24x24.png";}; + }; + Image IMG_LEFT_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columnleft_24x24.png";}; + }; + Image IMG_RIGHT_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columnright_24x24.png";}; + }; + String STR_ONE + { + Text [ en-US ] = "1 Column"; + }; + String STR_TWO + { + Text [ en-US ] = "2 Columns"; + }; + String STR_THREE + { + Text [ en-US ] = "3 Columns"; + }; + String STR_LEFT + { + Text [ en-US ] = "Left"; + }; + String STR_RIGHT + { + Text [ en-US ] = "Right"; + }; +}; diff --git a/sw/source/ui/sidebar/PageSizeControl.cxx b/sw/source/ui/sidebar/PageSizeControl.cxx new file mode 100644 index 000000000000..c54f3ee35b13 --- /dev/null +++ b/sw/source/ui/sidebar/PageSizeControl.cxx @@ -0,0 +1,186 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sw.hxx" + +#include "PageSizeControl.hxx" +#include "PagePropertyPanel.hxx" +#include "PagePropertyPanel.hrc" + +#include <cmdid.h> +#include <swtypes.hxx> + +#include <svx/sidebar/ValueSetWithTextControl.hxx> + +#include <tools/inetmime.hxx> +#include <editeng/paperinf.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> + + +namespace sw { namespace sidebar { + +PageSizeControl::PageSizeControl( + Window* pParent, + PagePropertyPanel& rPanel, + const Paper ePaper, + const sal_Bool bLandscape, + const FieldUnit eFUnit ) + : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_SIZE) ) + , mpSizeValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::TEXT_TEXT, this, SW_RES(VS_SIZE) ) ) + , maMoreButton( this, SW_RES(CB_SIZE_MORE) ) + , maWidthHeightField( this, SW_RES(FLD_WIDTH_HEIGHT) ) + , mePaper( ePaper ) + , maPaperList() + , mrPagePropPanel(rPanel) +{ + maWidthHeightField.Hide(); + SetFieldUnit( maWidthHeightField, eFUnit ); + + maPaperList.push_back( PAPER_A3 ); + maPaperList.push_back( PAPER_A4 ); + maPaperList.push_back( PAPER_A5 ); + maPaperList.push_back( PAPER_B4_ISO ); + maPaperList.push_back( PAPER_B5_ISO ); + maPaperList.push_back( PAPER_ENV_C5 ); + maPaperList.push_back( PAPER_LETTER ); + maPaperList.push_back( PAPER_LEGAL ); + + mpSizeValueSet->SetStyle( mpSizeValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT ); + mpSizeValueSet->SetColor( GetSettings().GetStyleSettings().GetMenuColor() ); + + sal_uInt16 nSelectedItem = 0; + { + XubString aMetricStr; + { + const XubString aText = maWidthHeightField.GetText(); + for (short i = aText.Len() - 1; i >= 0; i--) + { + xub_Unicode c = aText.GetChar(i); + if ( INetMIME::isAlpha(c) || (c == '\'') || (c == '\"') || (c == '%') ) + { + aMetricStr.Insert(c, 0); + } + else + { + if (aMetricStr.Len()) + { + break; + } + } + } + } + + const LocaleDataWrapper& localeDataWrapper = maWidthHeightField.GetLocaleDataWrapper(); + String WidthStr; + String HeightStr; + String ItemText2; + for ( ::std::vector< Paper >::size_type nPaperIdx = 0; + nPaperIdx < maPaperList.size(); + ++nPaperIdx ) + { + Size aPaperSize = SvxPaperInfo::GetPaperSize( maPaperList[ nPaperIdx ] ); + if ( bLandscape ) + { + Swap( aPaperSize ); + } + maWidthHeightField.SetValue( maWidthHeightField.Normalize( aPaperSize.Width() ), FUNIT_TWIP ); + WidthStr = localeDataWrapper.getNum( + maWidthHeightField.GetValue(), + maWidthHeightField.GetDecimalDigits(), + maWidthHeightField.IsUseThousandSep(), + maWidthHeightField.IsShowTrailingZeros() ); + + maWidthHeightField.SetValue( maWidthHeightField.Normalize( aPaperSize.Height() ), FUNIT_TWIP); + HeightStr = localeDataWrapper.getNum( + maWidthHeightField.GetValue(), + maWidthHeightField.GetDecimalDigits(), + maWidthHeightField.IsUseThousandSep(), + maWidthHeightField.IsShowTrailingZeros() ); + + ItemText2 = HeightStr; + ItemText2 += String::CreateFromAscii(" x "); + ItemText2 += WidthStr; + ItemText2 += String::CreateFromAscii(" "); + ItemText2 += aMetricStr; + + mpSizeValueSet->AddItem( + SvxPaperInfo::GetName( maPaperList[ nPaperIdx ] ), + ItemText2, + 0 ); + + if ( maPaperList[ nPaperIdx ] == mePaper ) + { + nSelectedItem = nPaperIdx + 1; + } + } + } + + mpSizeValueSet->SetNoSelection(); + mpSizeValueSet->SetSelectHdl( LINK(this, PageSizeControl,ImplSizeHdl ) ); + mpSizeValueSet->Show(); + + mpSizeValueSet->SelectItem( nSelectedItem ); + mpSizeValueSet->Format(); + mpSizeValueSet->StartSelection(); + + maMoreButton.SetClickHdl( LINK( this, PageSizeControl, MoreButtonClickHdl_Impl ) ); + maMoreButton.GrabFocus(); + + FreeResource(); +} + + +PageSizeControl::~PageSizeControl(void) +{ + delete mpSizeValueSet; +} + + +IMPL_LINK(PageSizeControl, ImplSizeHdl, void *, pControl) +{ + mpSizeValueSet->SetNoSelection(); + if ( pControl == mpSizeValueSet ) + { + const sal_uInt16 nSelectedPaper = mpSizeValueSet->GetSelectItemId(); + const Paper ePaper = maPaperList[nSelectedPaper - 1]; + if ( ePaper != mePaper ) + { + mePaper = ePaper; + mrPagePropPanel.ExecuteSizeChange( mePaper ); + } + } + + mrPagePropPanel.ClosePageSizePopup(); + return 0; +} + +IMPL_LINK(PageSizeControl, MoreButtonClickHdl_Impl, void *, EMPTYARG) +{ + mrPagePropPanel.GetBindings()->GetDispatcher()->Execute( FN_FORMAT_PAGE_SETTING_DLG, SFX_CALLMODE_ASYNCHRON ); + + mrPagePropPanel.ClosePageSizePopup(); + return 0; +} + + +} } // end of namespace sw::sidebar + diff --git a/sw/source/ui/sidebar/PageSizeControl.hxx b/sw/source/ui/sidebar/PageSizeControl.hxx new file mode 100644 index 000000000000..4e472f4ac05e --- /dev/null +++ b/sw/source/ui/sidebar/PageSizeControl.hxx @@ -0,0 +1,73 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SW_SIDEBAR_PAGE_SIZE_CONTROL_HXX_ +#define _SW_SIDEBAR_PAGE_SIZE_CONTROL_HXX_ + +#include <svx/sidebar/PopupControl.hxx> + +#include <i18npool/paper.hxx> + +#include <vcl/button.hxx> +#include <vcl/field.hxx> +#include <svtools/unitconv.hxx> + +#include <vector> + +namespace svx { namespace sidebar { + class ValueSetWithTextControl; +} } + +namespace sw { namespace sidebar { + +class PagePropertyPanel; + + +class PageSizeControl + : public ::svx::sidebar::PopupControl +{ +public: + PageSizeControl( + Window* pParent, + PagePropertyPanel& rPanel, + const Paper ePaper, + const sal_Bool bLandscape, + const FieldUnit eFUnit ); + ~PageSizeControl(void); + +private: + ::svx::sidebar::ValueSetWithTextControl* mpSizeValueSet; + PushButton maMoreButton; + // hidden metric field + MetricField maWidthHeightField; + + Paper mePaper; + ::std::vector< Paper > maPaperList; + + PagePropertyPanel& mrPagePropPanel; + + DECL_LINK(ImplSizeHdl, void*); + DECL_LINK(MoreButtonClickHdl_Impl, void*); +}; + +} } // end of namespace sw::sidebar + +#endif diff --git a/sw/source/ui/sidebar/PropertyPanel.hrc b/sw/source/ui/sidebar/PropertyPanel.hrc new file mode 100644 index 000000000000..066db8fadd1b --- /dev/null +++ b/sw/source/ui/sidebar/PropertyPanel.hrc @@ -0,0 +1,42 @@ +/************************************************************** +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*************************************************************/ + +#ifndef _SW_PROPERTY_PANEL_HRC +#define _SW_PROPERTY_PANEL_HRC + +#include "rcid.hrc" + +#define RID_PROPERTYPANEL_SWOBJWRAP_PAGE (RC_PROPERTYPANEL_BEGIN + 1) +#define RID_PROPERTYPANEL_SWPAGE (RC_PROPERTYPANEL_BEGIN + 2) +#define RID_POPUP_SWPAGE_MARGIN (RC_PROPERTYPANEL_BEGIN + 3) +#define RID_POPUP_SWPAGE_ORIENTATION (RC_PROPERTYPANEL_BEGIN + 4) +#define RID_POPUP_SWPAGE_COLUMN (RC_PROPERTYPANEL_BEGIN + 5) +#define RID_POPUP_SWPAGE_SIZE (RC_PROPERTYPANEL_BEGIN + 6) + +#define PROPERTY_PANEL_END RID_POPUP_SWPAGE_SIZE + +#if PROPERTY_SECTION_END > RC_PROPERTYPANEL_END +#error Resource-Id Ueberlauf in #file, #line +#endif + +#endif + + diff --git a/sw/source/ui/sidebar/SwPanelFactory.cxx b/sw/source/ui/sidebar/SwPanelFactory.cxx new file mode 100644 index 000000000000..9d5f043bc300 --- /dev/null +++ b/sw/source/ui/sidebar/SwPanelFactory.cxx @@ -0,0 +1,152 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sw.hxx" + +#include "SwPanelFactory.hxx" + +#include <PagePropertyPanel.hxx> +#include <WrapPropertyPanel.hxx> +#include <navipi.hxx> + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sfxbasecontroller.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/window.hxx> +#include <rtl/ref.hxx> +#include <comphelper/namedvaluecollection.hxx> + +#include <boost/bind.hpp> + + +using namespace css; +using namespace cssu; +using ::rtl::OUString; + + +namespace sw { namespace sidebar { + +#define A2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) +#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.sw.sidebar.SwPanelFactory" +#define SERVICE_NAME "com.sun.star.ui.UIElementFactory" + + +::rtl::OUString SAL_CALL SwPanelFactory::getImplementationName (void) +{ + return A2S(IMPLEMENTATION_NAME); +} + + +cssu::Reference<cssu::XInterface> SAL_CALL SwPanelFactory::createInstance( + const uno::Reference<lang::XMultiServiceFactory>& ) +{ + ::rtl::Reference<SwPanelFactory> pPanelFactory (new SwPanelFactory()); + cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pPanelFactory.get()), cssu::UNO_QUERY); + return xService; +} + + +cssu::Sequence<OUString> SAL_CALL SwPanelFactory::getSupportedServiceNames (void) +{ + cssu::Sequence<OUString> aServiceNames (1); + aServiceNames[0] = A2S(SERVICE_NAME); + return aServiceNames; + +} + + +SwPanelFactory::SwPanelFactory (void) + : PanelFactoryInterfaceBase(m_aMutex) +{ +} + + +SwPanelFactory::~SwPanelFactory (void) +{ +} + + +Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( + const ::rtl::OUString& rsResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + container::NoSuchElementException, + lang::IllegalArgumentException, + RuntimeException) +{ + Reference<ui::XUIElement> xElement; + + const ::comphelper::NamedValueCollection aArguments (rArguments); + Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>())); + Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>())); + const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0))); + SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); + + ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); + if ( ! xParentWindow.is() || pParentWindow==NULL) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without ParentWindow"), + NULL); + if ( ! xFrame.is()) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without Frame"), + NULL); + if (pBindings == NULL) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without SfxBindings"), + NULL); + +#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s)) + if (DoesResourceEndWith("/PagePropertyPanel")) + { + PagePropertyPanel* pPanel = PagePropertyPanel::Create( pParentWindow, pBindings ); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(-1,-1,-1)); + } + else if (DoesResourceEndWith("/WrapPropertyPanel")) + { + WrapPropertyPanel* pPanel = WrapPropertyPanel::Create( pParentWindow, xFrame, pBindings ); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(-1,-1,-1)); + } + else if (DoesResourceEndWith("/NavigatorPanel")) + { + Window* pPanel = new SwNavigationPI(pBindings, NULL, pParentWindow); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(0,-1,-1)); + } +#undef DoesResourceEndWith + + return xElement; +} + +} } // end of namespace sw::sidebar + +// eof diff --git a/sw/source/ui/sidebar/WrapPropertyPanel.cxx b/sw/source/ui/sidebar/WrapPropertyPanel.cxx new file mode 100644 index 000000000000..5a47697c142c --- /dev/null +++ b/sw/source/ui/sidebar/WrapPropertyPanel.cxx @@ -0,0 +1,266 @@ +/************************************************************** +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*************************************************************/ + +#include "precompiled_sw.hxx" + +#include "WrapPropertyPanel.hxx" +#include "WrapPropertyPanel.hrc" +#include "PropertyPanel.hrc" + +#include <cmdid.h> +#include <swtypes.hxx> + +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <sfx2/imagemgr.hxx> +#include <svl/eitem.hxx> +#include <vcl/svapp.hxx> + +#include "com/sun/star/lang/IllegalArgumentException.hpp" + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + + +namespace sw { namespace sidebar { + +WrapPropertyPanel* WrapPropertyPanel::Create ( + Window* pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw ::com::sun::star::lang::IllegalArgumentException(A2S("no parent Window given to PagePropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw ::com::sun::star::lang::IllegalArgumentException(A2S("no XFrame given to PagePropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw ::com::sun::star::lang::IllegalArgumentException(A2S("no SfxBindings given to PagePropertyPanel::Create"), NULL, 2); + + return new WrapPropertyPanel( + pParent, + rxFrame, + pBindings); +} + + +WrapPropertyPanel::WrapPropertyPanel( + Window* pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + SfxBindings* pBindings ) + : Control(pParent, SW_RES(RID_PROPERTYPANEL_SWOBJWRAP_PAGE)) + , mxFrame( rxFrame ) + , mpBindings(pBindings) + // visible controls + , mpRBNoWrap( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_NO_WRAP) ) ) + , mpRBWrapLeft( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_LEFT) ) ) + , mpRBWrapRight( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_RIGHT) ) ) + , mpRBWrapParallel( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_PARALLEL) ) ) + , mpRBWrapThrough( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_THROUGH) ) ) + , mpRBIdealWrap( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_IDEAL) ) ) + // resources + , aWrapIL(6,2) + , aWrapILH(6,2) + // controller items + , maSwNoWrapControl(FN_FRAME_NOWRAP, *pBindings, *this) + , maSwWrapLeftControl(FN_FRAME_WRAP, *pBindings, *this) + , maSwWrapRightControl(FN_FRAME_WRAP_RIGHT, *pBindings, *this) + , maSwWrapParallelControl(FN_FRAME_WRAP_LEFT, *pBindings, *this) + , maSwWrapThroughControl(FN_FRAME_WRAPTHRU, *pBindings, *this) + , maSwWrapIdealControl(FN_FRAME_WRAP_IDEAL, *pBindings, *this) +{ + Initialize(); + FreeResource(); +} + + +WrapPropertyPanel::~WrapPropertyPanel() +{ +} + + +void WrapPropertyPanel::Initialize() +{ + Link aLink = LINK(this, WrapPropertyPanel, WrapTypeHdl); + mpRBNoWrap->SetClickHdl(aLink); + mpRBWrapLeft->SetClickHdl(aLink); + mpRBWrapRight->SetClickHdl(aLink); + mpRBWrapParallel->SetClickHdl(aLink); + mpRBWrapThrough->SetClickHdl(aLink); + mpRBIdealWrap->SetClickHdl(aLink); + + aWrapIL.AddImage( IMG_NONE, + ::GetImage( mxFrame, A2S(".uno:WrapOff"), sal_False, sal_False ) ); + aWrapIL.AddImage( IMG_LEFT, + ::GetImage( mxFrame, A2S(".uno:WrapLeft"), sal_False, sal_False ) ); + aWrapIL.AddImage( IMG_RIGHT, + ::GetImage( mxFrame, A2S(".uno:WrapRight"), sal_False, sal_False ) ); + aWrapIL.AddImage( IMG_PARALLEL, + ::GetImage( mxFrame, A2S(".uno:WrapOn"), sal_False, sal_False ) ); + aWrapIL.AddImage( IMG_THROUGH, + ::GetImage( mxFrame, A2S(".uno:WrapThrough"), sal_False, sal_False ) ); + aWrapIL.AddImage( IMG_IDEAL, + ::GetImage( mxFrame, A2S(".uno:WrapIdeal"), sal_False, sal_False ) ); + + aWrapILH.AddImage( IMG_NONE, + ::GetImage( mxFrame, A2S(".uno:WrapOff"), sal_False, sal_True ) ); + aWrapILH.AddImage( IMG_LEFT, + ::GetImage( mxFrame, A2S(".uno:WrapLeft"), sal_False, sal_True ) ); + aWrapILH.AddImage( IMG_RIGHT, + ::GetImage( mxFrame, A2S(".uno:WrapRight"), sal_False, sal_True ) ); + aWrapILH.AddImage( IMG_PARALLEL, + ::GetImage( mxFrame, A2S(".uno:WrapOn"), sal_False, sal_True ) ); + aWrapILH.AddImage( IMG_THROUGH, + ::GetImage( mxFrame, A2S(".uno:WrapThrough"), sal_False, sal_True ) ); + aWrapILH.AddImage( IMG_IDEAL, + ::GetImage( mxFrame, A2S(".uno:WrapIdeal"), sal_False, sal_True ) ); + + mpRBNoWrap->SetModeRadioImage( aWrapIL.GetImage(IMG_NONE) ); + mpRBNoWrap->SetModeRadioImage( aWrapILH.GetImage(IMG_NONE) , BMP_COLOR_HIGHCONTRAST ); + if ( Application::GetSettings().GetLayoutRTL() ) + { + mpRBWrapLeft->SetModeRadioImage( aWrapIL.GetImage(IMG_RIGHT) ); + mpRBWrapLeft->SetModeRadioImage( aWrapILH.GetImage(IMG_RIGHT) , BMP_COLOR_HIGHCONTRAST ); + mpRBWrapRight->SetModeRadioImage( aWrapIL.GetImage(IMG_LEFT) ); + mpRBWrapRight->SetModeRadioImage( aWrapILH.GetImage(IMG_LEFT) , BMP_COLOR_HIGHCONTRAST ); + } + else + { + mpRBWrapLeft->SetModeRadioImage( aWrapIL.GetImage(IMG_LEFT) ); + mpRBWrapLeft->SetModeRadioImage( aWrapILH.GetImage(IMG_LEFT) , BMP_COLOR_HIGHCONTRAST ); + mpRBWrapRight->SetModeRadioImage( aWrapIL.GetImage(IMG_RIGHT) ); + mpRBWrapRight->SetModeRadioImage( aWrapILH.GetImage(IMG_RIGHT) , BMP_COLOR_HIGHCONTRAST ); + } + mpRBWrapParallel->SetModeRadioImage( aWrapIL.GetImage(IMG_PARALLEL) ); + mpRBWrapParallel->SetModeRadioImage( aWrapILH.GetImage(IMG_PARALLEL) , BMP_COLOR_HIGHCONTRAST ); + mpRBWrapThrough->SetModeRadioImage( aWrapIL.GetImage(IMG_THROUGH) ); + mpRBWrapThrough->SetModeRadioImage( aWrapILH.GetImage(IMG_THROUGH) , BMP_COLOR_HIGHCONTRAST ); + mpRBIdealWrap->SetModeRadioImage( aWrapIL.GetImage(IMG_IDEAL) ); + mpRBIdealWrap->SetModeRadioImage( aWrapILH.GetImage(IMG_IDEAL) , BMP_COLOR_HIGHCONTRAST ); + + mpRBNoWrap->SetAccessibleName(mpRBNoWrap->GetQuickHelpText()); + mpRBWrapLeft->SetAccessibleName(mpRBWrapLeft->GetQuickHelpText()); + mpRBWrapRight->SetAccessibleName(mpRBWrapRight->GetQuickHelpText()); + mpRBWrapParallel->SetAccessibleName(mpRBWrapParallel->GetQuickHelpText()); + mpRBWrapThrough->SetAccessibleName(mpRBWrapThrough->GetQuickHelpText()); + mpRBIdealWrap->SetAccessibleName(mpRBIdealWrap->GetQuickHelpText()); + + mpBindings->Update( FN_FRAME_NOWRAP ); + mpBindings->Update( FN_FRAME_WRAP ); + mpBindings->Update( FN_FRAME_WRAP_RIGHT ); + mpBindings->Update( FN_FRAME_WRAP_LEFT ); + mpBindings->Update( FN_FRAME_WRAPTHRU ); + mpBindings->Update( FN_FRAME_WRAP_IDEAL ); +} + + +IMPL_LINK(WrapPropertyPanel, WrapTypeHdl, void *, EMPTYARG) +{ + sal_uInt16 nSlot = 0; + if ( mpRBWrapLeft->IsChecked() ) + { + nSlot = FN_FRAME_WRAP_LEFT; + } + else if( mpRBWrapRight->IsChecked() ) + { + nSlot = FN_FRAME_WRAP_RIGHT; + } + else if ( mpRBWrapParallel->IsChecked() ) + { + nSlot = FN_FRAME_WRAP; + } + else if( mpRBWrapThrough->IsChecked() ) + { + nSlot = FN_FRAME_WRAPTHRU; + } + else if( mpRBIdealWrap->IsChecked() ) + { + nSlot = FN_FRAME_WRAP_IDEAL; + } + else + { + nSlot = FN_FRAME_NOWRAP; + } + SfxBoolItem bStateItem( nSlot, sal_True ); + mpBindings->GetDispatcher()->Execute( nSlot, SFX_CALLMODE_RECORD, &bStateItem, 0L ); + + return 0; +} + + +void WrapPropertyPanel::NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState ) +{ + if ( eState == SFX_ITEM_AVAILABLE && + pState->ISA(SfxBoolItem) ) + { + //Set Radio Button enable + mpRBNoWrap->Enable(true); + mpRBWrapLeft->Enable(true); + mpRBWrapRight->Enable(true); + mpRBWrapParallel->Enable(true); + mpRBWrapThrough->Enable(true); + mpRBIdealWrap->Enable(true); + + const SfxBoolItem* pBoolItem = static_cast< const SfxBoolItem* >( pState ); + switch( nSId ) + { + case FN_FRAME_WRAP_RIGHT: + mpRBWrapRight->Check( pBoolItem->GetValue() ); + break; + case FN_FRAME_WRAP_LEFT: + mpRBWrapLeft->Check( pBoolItem->GetValue() ); + break; + case FN_FRAME_WRAPTHRU: + mpRBWrapThrough->Check( pBoolItem->GetValue() ); + break; + case FN_FRAME_WRAP_IDEAL: + mpRBIdealWrap->Check( pBoolItem->GetValue() ); + break; + case FN_FRAME_WRAP: + mpRBWrapParallel->Check( pBoolItem->GetValue() ); + break; + case FN_FRAME_NOWRAP: + default: + mpRBNoWrap->Check( pBoolItem->GetValue() ); + break; + } + } + else + { + mpRBNoWrap->Enable(false); + mpRBWrapLeft->Enable(false); + mpRBWrapRight->Enable(false); + mpRBWrapParallel->Enable(false); + mpRBWrapThrough->Enable(false); + mpRBIdealWrap->Enable(false); + + mpRBNoWrap->Check( sal_False ); + mpRBWrapLeft->Check( sal_False ); + mpRBWrapRight->Check( sal_False ); + mpRBWrapParallel->Check( sal_False ); + mpRBWrapThrough->Check( sal_False ); + mpRBIdealWrap->Check( sal_False ); + } +} + +} } // end of namespace ::sw::sidebar diff --git a/sw/source/ui/sidebar/WrapPropertyPanel.hrc b/sw/source/ui/sidebar/WrapPropertyPanel.hrc new file mode 100644 index 000000000000..c7989b80a518 --- /dev/null +++ b/sw/source/ui/sidebar/WrapPropertyPanel.hrc @@ -0,0 +1,42 @@ +/************************************************************** +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*************************************************************/ + +#ifndef _SW_WRAPPROPERTYPANEL_HRC +#define _SW_WRAPPROPERTYPANEL_HRC + +// RID_PROPERTYPANEL_SWOBJWRAP_PAGE +#define RB_NO_WRAP 1 +#define RB_WRAP_LEFT 2 +#define RB_WRAP_RIGHT 3 +#define RB_WRAP_PARALLEL 4 +#define RB_WRAP_THROUGH 5 +#define RB_WRAP_IDEAL 6 + +// only for the ImageLists +#define IMG_BEGIN 1 +#define IMG_NONE (IMG_BEGIN) +#define IMG_LEFT (IMG_BEGIN + 1) +#define IMG_RIGHT (IMG_BEGIN + 2) +#define IMG_PARALLEL (IMG_BEGIN + 3) +#define IMG_THROUGH (IMG_BEGIN + 4) +#define IMG_IDEAL (IMG_BEGIN + 5) + +#endif
\ No newline at end of file diff --git a/sw/source/ui/sidebar/WrapPropertyPanel.hxx b/sw/source/ui/sidebar/WrapPropertyPanel.hxx new file mode 100644 index 000000000000..27d1b9c39a47 --- /dev/null +++ b/sw/source/ui/sidebar/WrapPropertyPanel.hxx @@ -0,0 +1,89 @@ +/************************************************************** +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*************************************************************/ + +#ifndef SW_SIDEBAR_WRAP_PROPERTY_PANEL_HXX +#define SW_SIDEBAR_WRAP_PROPERTY_PANEL_HXX + +#include <vcl/button.hxx> +#include <vcl/image.hxx> + +#include <sfx2/sidebar/ControllerItem.hxx> +#include <com/sun/star/frame/XFrame.hpp> + +#include <boost/scoped_ptr.hpp> + + +namespace sw { namespace sidebar { + + class WrapPropertyPanel + : public Control + , public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface + { + public: + static WrapPropertyPanel* Create( + Window* pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame, + SfxBindings* pBindings ); + + // interface of ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState ); + + private: + WrapPropertyPanel( + Window* pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + SfxBindings* pBindings ); + + virtual ~WrapPropertyPanel(); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; + SfxBindings* mpBindings; + + ::boost::scoped_ptr<ImageRadioButton> mpRBNoWrap; + ::boost::scoped_ptr<ImageRadioButton> mpRBWrapLeft; + ::boost::scoped_ptr<ImageRadioButton> mpRBWrapRight; + ::boost::scoped_ptr<ImageRadioButton> mpRBWrapParallel; + ::boost::scoped_ptr<ImageRadioButton> mpRBWrapThrough; + ::boost::scoped_ptr<ImageRadioButton> mpRBIdealWrap; + + //Image resource. + ImageList aWrapIL; + ImageList aWrapILH; + + //Controler Items================================== + ::sfx2::sidebar::ControllerItem maSwNoWrapControl; + ::sfx2::sidebar::ControllerItem maSwWrapLeftControl; + ::sfx2::sidebar::ControllerItem maSwWrapRightControl; + ::sfx2::sidebar::ControllerItem maSwWrapParallelControl; + ::sfx2::sidebar::ControllerItem maSwWrapThroughControl; + ::sfx2::sidebar::ControllerItem maSwWrapIdealControl; + + void Initialize(); + + DECL_LINK(WrapTypeHdl, void*); + }; + +} } // end of namespace ::sw::sidebar + +#endif diff --git a/sw/source/ui/sidebar/WrapPropertyPanel.src b/sw/source/ui/sidebar/WrapPropertyPanel.src new file mode 100644 index 000000000000..ceb4157ad398 --- /dev/null +++ b/sw/source/ui/sidebar/WrapPropertyPanel.src @@ -0,0 +1,90 @@ +/************************************************************** +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*************************************************************/ + +#include <sfx2/sidebar/propertypanel.hrc> +#include "PropertyPanel.hrc" +#include "WrapPropertyPanel.hrc" +#include "helpid.h" + +#define IMAGEBUTTON_WIDTH 16 +#define IMAGEBUTTON_HEIGH 18 +#define IMAGEBUTTON_GAP 1 + +Control RID_PROPERTYPANEL_SWOBJWRAP_PAGE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, SECTIONPAGE_MARGIN_VERTICAL_BOT + SECTIONPAGE_MARGIN_VERTICAL_TOP + IMAGEBUTTON_HEIGH ); + HelpID = HID_PROPERTYPANEL_WRAP_SECTION ; + Text [ en-US ] = "Wrap"; + + + ImageRadioButton RB_NO_WRAP + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT ( IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH ); + TopImage = True; + HelpID = HID_PROPERTYPANEL_WRAP_RB_NO_WRAP ; + QuickHelpText [ en-US ] = "None"; + }; + ImageRadioButton RB_WRAP_LEFT + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP, SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT ( IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH ); + TopImage = True; + HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_LEFT ; + QuickHelpText [ en-US ] = "Before"; + }; + ImageRadioButton RB_WRAP_RIGHT + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + (IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP)*2 , SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT ( IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH ); + TopImage = True; + HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_RIGHT ; + QuickHelpText [ en-US ] = "After"; + }; + ImageRadioButton RB_WRAP_PARALLEL + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + (IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP)*3 , SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT (IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH ); + TopImage = True; + HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_PARALLEL ; + QuickHelpText [ en-US ] = "Parallel"; + }; + ImageRadioButton RB_WRAP_THROUGH + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + (IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP)*4 , SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT (IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH ); + TopImage = True; + HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_THROUGH ; + QuickHelpText [ en-US ] = "Through"; + }; + ImageRadioButton RB_WRAP_IDEAL + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + (IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP)*5 , SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT (IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH ); + TopImage = True; + HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_IDEAL ; + QuickHelpText [ en-US ] = "Optimal"; + }; +}; diff --git a/sw/source/ui/uiview/view0.cxx b/sw/source/ui/uiview/view0.cxx index 667c002a7117..1c0a1af6d727 100644 --- a/sw/source/ui/uiview/view0.cxx +++ b/sw/source/ui/uiview/view0.cxx @@ -43,6 +43,7 @@ #include <sfx2/templdlg.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/bindings.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include <uivwimp.hxx> #include <avmedia/mediaplayer.hxx> //#include <swlinguconfig.hxx> @@ -109,6 +110,7 @@ SFX_IMPL_INTERFACE( SwView, SfxViewShell, SW_RES(RID_TOOLS_TOOLBOX) ) { SFX_CHILDWINDOW_CONTEXT_REGISTRATION(SID_NAVIGATOR); SFX_CHILDWINDOW_REGISTRATION(SID_TASKPANE); + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(SfxTemplateDialogWrapper::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(SvxSearchDialogWrapper::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(SwSpellDialogChildWindow::GetChildWindowId()); diff --git a/sw/source/ui/uiview/view1.cxx b/sw/source/ui/uiview/view1.cxx index cfc5e379b939..1f8d69312d14 100644 --- a/sw/source/ui/uiview/view1.cxx +++ b/sw/source/ui/uiview/view1.cxx @@ -28,6 +28,7 @@ #include <svx/svdpagv.hxx> #include <svx/svdview.hxx> #include <svx/ruler.hxx> +#include <svx/sidebar/ContextChangeEventMultiplexer.hxx> #include <idxmrk.hxx> #ifndef _VIEW_HXX #include <view.hxx> diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 88cf635f78c4..f2eff43c2a5b 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -1093,9 +1093,9 @@ void __EXPORT SwView::Execute(SfxRequest &rReq) case SID_ALIGN_ANY_HCENTER : nAlias = SID_ATTR_PARA_ADJUST_CENTER; break; case SID_ALIGN_ANY_RIGHT : nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break; case SID_ALIGN_ANY_JUSTIFIED: nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break; - case SID_ALIGN_ANY_TOP : nAlias = FN_TABLE_VERT_NONE; break; - case SID_ALIGN_ANY_VCENTER : nAlias = FN_TABLE_VERT_CENTER; break; - case SID_ALIGN_ANY_BOTTOM : nAlias = FN_TABLE_VERT_BOTTOM; break; + case SID_ALIGN_ANY_TOP : nAlias = SID_TABLE_VERT_NONE; break; + case SID_ALIGN_ANY_VCENTER : nAlias = SID_TABLE_VERT_CENTER; break; + case SID_ALIGN_ANY_BOTTOM : nAlias = SID_TABLE_VERT_BOTTOM; break; } } else diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx index 43e2547974c8..c0073d99e231 100644 --- a/sw/source/ui/uiview/viewstat.cxx +++ b/sw/source/ui/uiview/viewstat.cxx @@ -389,9 +389,9 @@ void SwView::GetState(SfxItemSet &rSet) case SID_ALIGN_ANY_HCENTER : nAlias = SID_ATTR_PARA_ADJUST_CENTER; break; case SID_ALIGN_ANY_RIGHT : nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break; case SID_ALIGN_ANY_JUSTIFIED: nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break; - case SID_ALIGN_ANY_TOP : nAlias = FN_TABLE_VERT_NONE; break; - case SID_ALIGN_ANY_VCENTER : nAlias = FN_TABLE_VERT_CENTER; break; - case SID_ALIGN_ANY_BOTTOM : nAlias = FN_TABLE_VERT_BOTTOM; break; + case SID_ALIGN_ANY_TOP : nAlias = SID_TABLE_VERT_NONE; break; + case SID_ALIGN_ANY_VCENTER : nAlias = SID_TABLE_VERT_CENTER; break; + case SID_ALIGN_ANY_BOTTOM : nAlias = SID_TABLE_VERT_BOTTOM; break; } } else if(nSelectionType & (nsSelectionType::SEL_DRW)) diff --git a/sw/source/ui/uiview/viewtab.cxx b/sw/source/ui/uiview/viewtab.cxx index 9c267016962f..34552df9e946 100644 --- a/sw/source/ui/uiview/viewtab.cxx +++ b/sw/source/ui/uiview/viewtab.cxx @@ -296,231 +296,249 @@ void SwView::ExecTabWin( SfxRequest& rReq ) rSh.StartAllAction(); sal_Bool bSect = 0 != (nFrmType & FRMTYPE_COLSECT); - switch ( nSlot ) + switch( nSlot ) { case SID_ATTR_LONG_LRSPACE: - { - SvxLongLRSpaceItem aLongLR( (const SvxLongLRSpaceItem&)rReq.GetArgs()-> - Get( SID_ATTR_LONG_LRSPACE ) ); - SvxLRSpaceItem aLR(RES_LR_SPACE); - if ( !bSect && (bFrmSelection || nFrmType & FRMTYPE_FLY_ANY) ) { - SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt()); - const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED); - - sal_Bool bVerticalFrame(sal_False); + SvxLongLRSpaceItem aLongLR( (const SvxLongLRSpaceItem&)rReq.GetArgs()-> + Get( SID_ATTR_LONG_LRSPACE ) ); + SvxLRSpaceItem aLR(RES_LR_SPACE); + if ( !bSect && (bFrmSelection || nFrmType & FRMTYPE_FLY_ANY) ) { - sal_Bool bRTL; - sal_Bool bVertL2R; - bVerticalFrame = ( bFrmSelection && - rSh.IsFrmVertical(sal_True, bRTL, bVertL2R) ) || - ( !bFrmSelection && bVerticalWriting); - } - long nDeltaX = bVerticalFrame ? - rRect.Right() - rPageRect.Right() + aLongLR.GetRight() : - rPageRect.Left() + aLongLR.GetLeft() - rRect.Left(); + SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt()); + const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED); - SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE, - RES_VERT_ORIENT, RES_HORI_ORIENT, - RES_COL, RES_COL, 0 ); + sal_Bool bVerticalFrame(sal_False); + { + sal_Bool bRTL; + sal_Bool bVertL2R; + bVerticalFrame = ( bFrmSelection && + rSh.IsFrmVertical(sal_True, bRTL, bVertL2R) ) || + ( !bFrmSelection && bVerticalWriting); + } + long nDeltaX = bVerticalFrame ? + rRect.Right() - rPageRect.Right() + aLongLR.GetRight() : + rPageRect.Left() + aLongLR.GetLeft() - rRect.Left(); - if(bVerticalFrame) - { - SwFmtVertOrient aVertOrient(pFmt->GetVertOrient()); - aVertOrient.SetVertOrient(text::VertOrientation::NONE); - aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaX ); - aSet.Put( aVertOrient ); - } - else - { - SwFmtHoriOrient aHoriOrient( pFmt->GetHoriOrient() ); - aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE ); - aHoriOrient.SetPos( aHoriOrient.GetPos() + nDeltaX ); - aSet.Put( aHoriOrient ); - } + SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE, + RES_VERT_ORIENT, RES_HORI_ORIENT, + RES_COL, RES_COL, 0 ); - SwFmtFrmSize aSize( pFmt->GetFrmSize() ); - long nOldWidth = (long) aSize.GetWidth(); + if(bVerticalFrame) + { + SwFmtVertOrient aVertOrient(pFmt->GetVertOrient()); + aVertOrient.SetVertOrient(text::VertOrientation::NONE); + aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaX ); + aSet.Put( aVertOrient ); + } + else + { + SwFmtHoriOrient aHoriOrient( pFmt->GetHoriOrient() ); + aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE ); + aHoriOrient.SetPos( aHoriOrient.GetPos() + nDeltaX ); + aSet.Put( aHoriOrient ); + } - if(aSize.GetWidthPercent()) - { - SwRect aRect; - rSh.CalcBoundRect(aRect, FLY_AS_CHAR); - long nPrtWidth = aRect.Width(); - aSize.SetWidthPercent(sal_uInt8((nPageWidth - aLongLR.GetLeft() - aLongLR.GetRight()) * 100 /nPrtWidth)); - } - else - aSize.SetWidth( nPageWidth - - (aLongLR.GetLeft() + aLongLR.GetRight())); + SwFmtFrmSize aSize( pFmt->GetFrmSize() ); + long nOldWidth = (long) aSize.GetWidth(); - if( nFrmType & FRMTYPE_COLUMN ) - { - SwFmtCol aCol(pFmt->GetCol()); + if(aSize.GetWidthPercent()) + { + SwRect aRect; + rSh.CalcBoundRect(aRect, FLY_AS_CHAR); + long nPrtWidth = aRect.Width(); + aSize.SetWidthPercent(sal_uInt8((nPageWidth - aLongLR.GetLeft() - aLongLR.GetRight()) * 100 /nPrtWidth)); + } + else + aSize.SetWidth( nPageWidth - + (aLongLR.GetLeft() + aLongLR.GetRight())); - ::ResizeFrameCols(aCol, nOldWidth, (long)aSize.GetWidth(), nDeltaX ); - aSet.Put(aCol); - } + if( nFrmType & FRMTYPE_COLUMN ) + { + SwFmtCol aCol(pFmt->GetCol()); + + ::ResizeFrameCols(aCol, nOldWidth, (long)aSize.GetWidth(), nDeltaX ); + aSet.Put(aCol); + } - aSet.Put( aSize ); + aSet.Put( aSize ); - rSh.StartAction(); - rSh.Push(); - rSh.SetFlyFrmAttr( aSet ); - //die Rahmenselektion wieder aufheben - if(!bFrmSelection && rSh.IsFrmSelected()) + rSh.StartAction(); + rSh.Push(); + rSh.SetFlyFrmAttr( aSet ); + //die Rahmenselektion wieder aufheben + if(!bFrmSelection && rSh.IsFrmSelected()) + { + rSh.UnSelectFrm(); + rSh.LeaveSelFrmMode(); + } + rSh.Pop(); + rSh.EndAction(); + } + else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER )) { - rSh.UnSelectFrm(); - rSh.LeaveSelFrmMode(); + // Seitenraender rausrechnen + long nOld = rDesc.GetMaster().GetLRSpace().GetLeft(); + aLongLR.SetLeft( nOld > aLongLR.GetLeft() ? 0 : aLongLR.GetLeft() - nOld ); + + nOld = rDesc.GetMaster().GetLRSpace().GetRight(); + aLongLR.SetRight( nOld > (sal_uInt16)aLongLR.GetRight() ? 0 : aLongLR.GetRight() - nOld ); + aLR.SetLeft((sal_uInt16)aLongLR.GetLeft()); + aLR.SetRight((sal_uInt16)aLongLR.GetRight()); + + if ( nFrmType & FRMTYPE_HEADER && pHeaderFmt ) + pHeaderFmt->SetFmtAttr( aLR ); + else if( nFrmType & FRMTYPE_FOOTER && pFooterFmt ) + pFooterFmt->SetFmtAttr( aLR ); } - rSh.Pop(); - rSh.EndAction(); - } - else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER )) - { - // Seitenraender rausrechnen - long nOld = rDesc.GetMaster().GetLRSpace().GetLeft(); - aLongLR.SetLeft( nOld > aLongLR.GetLeft() ? 0 : aLongLR.GetLeft() - nOld ); - - nOld = rDesc.GetMaster().GetLRSpace().GetRight(); - aLongLR.SetRight( nOld > (sal_uInt16)aLongLR.GetRight() ? 0 : aLongLR.GetRight() - nOld ); - aLR.SetLeft((sal_uInt16)aLongLR.GetLeft()); - aLR.SetRight((sal_uInt16)aLongLR.GetRight()); - - if ( nFrmType & FRMTYPE_HEADER && pHeaderFmt ) - pHeaderFmt->SetFmtAttr( aLR ); - else if( nFrmType & FRMTYPE_FOOTER && pFooterFmt ) - pFooterFmt->SetFmtAttr( aLR ); - } - else if( nFrmType == FRMTYPE_DRAWOBJ) - { - SwRect aRect( rSh.GetObjRect() ); - aRect.Left( aLongLR.GetLeft() + rPageRect.Left() ); - aRect.Right( rPageRect.Right() - aLongLR.GetRight()); - rSh.SetObjRect( aRect ); - } - else if(bSect || rSh.IsDirectlyInSection()) - { - //change the section indents and the columns if available - //at first determine the changes - SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0); - const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0); - aSectRect.Pos() += aTmpRect.Pos(); - long nLeftDiff = aLongLR.GetLeft() - (long)(aSectRect.Left() - rPageRect.Left() ); - long nRightDiff = aLongLR.GetRight() - (long)( rPageRect.Right() - aSectRect.Right()); - //change the LRSpaceItem of the section accordingly - const SwSection* pCurrSect = rSh.GetCurrSection(); - const SwSectionFmt* pSectFmt = pCurrSect->GetFmt(); - SvxLRSpaceItem aLRTmp = pSectFmt->GetLRSpace(); - aLRTmp.SetLeft(aLRTmp.GetLeft() + nLeftDiff); - aLRTmp.SetRight(aLRTmp.GetRight() + nRightDiff); - SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L); - aSet.Put(aLRTmp); - //change the first/last column - if(bSect) + else if( nFrmType == FRMTYPE_DRAWOBJ) + { + SwRect aRect( rSh.GetObjRect() ); + aRect.Left( aLongLR.GetLeft() + rPageRect.Left() ); + aRect.Right( rPageRect.Right() - aLongLR.GetRight()); + rSh.SetObjRect( aRect ); + } + else if(bSect || rSh.IsDirectlyInSection()) { - SwFmtCol aCols( pSectFmt->GetCol() ); - long nDiffWidth = nLeftDiff + nRightDiff; - ::ResizeFrameCols(aCols, aSectRect.Width(), aSectRect.Width() - nDiffWidth, nLeftDiff ); - aSet.Put( aCols ); + //change the section indents and the columns if available + //at first determine the changes + SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0); + const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0); + aSectRect.Pos() += aTmpRect.Pos(); + long nLeftDiff = aLongLR.GetLeft() - (long)(aSectRect.Left() - rPageRect.Left() ); + long nRightDiff = aLongLR.GetRight() - (long)( rPageRect.Right() - aSectRect.Right()); + //change the LRSpaceItem of the section accordingly + const SwSection* pCurrSect = rSh.GetCurrSection(); + const SwSectionFmt* pSectFmt = pCurrSect->GetFmt(); + SvxLRSpaceItem aLRTmp = pSectFmt->GetLRSpace(); + aLRTmp.SetLeft(aLRTmp.GetLeft() + nLeftDiff); + aLRTmp.SetRight(aLRTmp.GetRight() + nRightDiff); + SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L); + aSet.Put(aLRTmp); + //change the first/last column + if(bSect) + { + SwFmtCol aCols( pSectFmt->GetCol() ); + long nDiffWidth = nLeftDiff + nRightDiff; + ::ResizeFrameCols(aCols, aSectRect.Width(), aSectRect.Width() - nDiffWidth, nLeftDiff ); + aSet.Put( aCols ); + } + SwSectionData aData(*pCurrSect); + rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet); + } + else + { // Seitenraender einstellen + aLR.SetLeft((sal_uInt16)aLongLR.GetLeft()); + aLR.SetRight((sal_uInt16)aLongLR.GetRight()); + SwapPageMargin( rDesc, aLR ); + SwPageDesc aDesc( rDesc ); + aDesc.GetMaster().SetFmtAttr( aLR ); + rSh.ChgPageDesc( nDescId, aDesc ); } - SwSectionData aData(*pCurrSect); - rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet); } - else - { // Seitenraender einstellen - aLR.SetLeft((sal_uInt16)aLongLR.GetLeft()); - aLR.SetRight((sal_uInt16)aLongLR.GetRight()); - SwapPageMargin( rDesc, aLR ); + break; + + // apply new left and right margins to current page style + case SID_ATTR_PAGE_LRSPACE: + { + const SvxLongLRSpaceItem aLongLR( static_cast<const SvxLongLRSpaceItem&>(rReq.GetArgs()->Get( SID_ATTR_PAGE_LRSPACE )) ); + SwPageDesc aDesc( rDesc ); - aDesc.GetMaster().SetFmtAttr( aLR ); + { + SvxLRSpaceItem aLR( RES_LR_SPACE ); + aLR.SetLeft((sal_uInt16)aLongLR.GetLeft()); + aLR.SetRight((sal_uInt16)aLongLR.GetRight()); + SwapPageMargin( rDesc, aLR ); + aDesc.GetMaster().SetFmtAttr( aLR ); + } rSh.ChgPageDesc( nDescId, aDesc ); } - } - break; - case SID_ATTR_LONG_ULSPACE: - { - SvxLongULSpaceItem aLongULSpace( (const SvxLongULSpaceItem&)rReq.GetArgs()-> - Get( SID_ATTR_LONG_ULSPACE )); + break; - if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) + case SID_ATTR_LONG_ULSPACE: { - SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt()); - const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED); - const long nDeltaY = rPageRect.Top() + aLongULSpace.GetUpper() - rRect.Top(); - const long nHeight = nPageHeight - (aLongULSpace.GetUpper() + aLongULSpace.GetLower()); - - SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE, - RES_VERT_ORIENT, RES_HORI_ORIENT, 0 ); - //which of the orientation attributes is to be put depends on the frame's environment - sal_Bool bRTL; - sal_Bool bVertL2R; - if ( ( bFrmSelection && - rSh.IsFrmVertical(sal_True, bRTL, bVertL2R ) ) || - ( !bFrmSelection && bVerticalWriting ) ) + SvxLongULSpaceItem aLongULSpace( (const SvxLongULSpaceItem&)rReq.GetArgs()-> + Get( SID_ATTR_LONG_ULSPACE )); + + if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) { - SwFmtHoriOrient aHoriOrient(pFmt->GetHoriOrient()); - aHoriOrient.SetHoriOrient(text::HoriOrientation::NONE); - aHoriOrient.SetPos(aHoriOrient.GetPos() + nDeltaY ); - aSet.Put( aHoriOrient ); + SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt()); + const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED); + const long nDeltaY = rPageRect.Top() + aLongULSpace.GetUpper() - rRect.Top(); + const long nHeight = nPageHeight - (aLongULSpace.GetUpper() + aLongULSpace.GetLower()); + + SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE, + RES_VERT_ORIENT, RES_HORI_ORIENT, 0 ); + //which of the orientation attributes is to be put depends on the frame's environment + sal_Bool bRTL; + sal_Bool bVertL2R; + if ( ( bFrmSelection && + rSh.IsFrmVertical(sal_True, bRTL, bVertL2R ) ) || + ( !bFrmSelection && bVerticalWriting ) ) + { + SwFmtHoriOrient aHoriOrient(pFmt->GetHoriOrient()); + aHoriOrient.SetHoriOrient(text::HoriOrientation::NONE); + aHoriOrient.SetPos(aHoriOrient.GetPos() + nDeltaY ); + aSet.Put( aHoriOrient ); + } + else + { + SwFmtVertOrient aVertOrient(pFmt->GetVertOrient()); + aVertOrient.SetVertOrient(text::VertOrientation::NONE); + aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaY ); + aSet.Put( aVertOrient ); + } + SwFmtFrmSize aSize(pFmt->GetFrmSize()); + if(aSize.GetHeightPercent()) + { + SwRect aRect; + rSh.CalcBoundRect(aRect, FLY_AS_CHAR); + long nPrtHeight = aRect.Height(); + aSize.SetHeightPercent(sal_uInt8(nHeight * 100 /nPrtHeight)); + } + else + aSize.SetHeight(nHeight ); + + aSet.Put( aSize ); + rSh.SetFlyFrmAttr( aSet ); } - else + else if( nFrmType == FRMTYPE_DRAWOBJ ) { - SwFmtVertOrient aVertOrient(pFmt->GetVertOrient()); - aVertOrient.SetVertOrient(text::VertOrientation::NONE); - aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaY ); - aSet.Put( aVertOrient ); + SwRect aRect( rSh.GetObjRect() ); + aRect.Top( aLongULSpace.GetUpper() + rPageRect.Top() ); + aRect.Bottom( rPageRect.Bottom() - aLongULSpace.GetLower() ); + rSh.SetObjRect( aRect ) ; } - SwFmtFrmSize aSize(pFmt->GetFrmSize()); - if(aSize.GetHeightPercent()) + else if(bVerticalWriting && (bSect || rSh.IsDirectlyInSection())) { - SwRect aRect; - rSh.CalcBoundRect(aRect, FLY_AS_CHAR); - long nPrtHeight = aRect.Height(); - aSize.SetHeightPercent(sal_uInt8(nHeight * 100 /nPrtHeight)); + //change the section indents and the columns if available + //at first determine the changes + SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0); + const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0); + aSectRect.Pos() += aTmpRect.Pos(); + const long nLeftDiff = aLongULSpace.GetUpper() - (long)(aSectRect.Top() - rPageRect.Top()); + const long nRightDiff = aLongULSpace.GetLower() - (long)(nPageHeight - aSectRect.Bottom() + rPageRect.Top()); + //change the LRSpaceItem of the section accordingly + const SwSection* pCurrSect = rSh.GetCurrSection(); + const SwSectionFmt* pSectFmt = pCurrSect->GetFmt(); + SvxLRSpaceItem aLR = pSectFmt->GetLRSpace(); + aLR.SetLeft(aLR.GetLeft() + nLeftDiff); + aLR.SetRight(aLR.GetRight() + nRightDiff); + SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L); + aSet.Put(aLR); + //change the first/last column + if(bSect) + { + SwFmtCol aCols( pSectFmt->GetCol() ); + long nDiffWidth = nLeftDiff + nRightDiff; + ::ResizeFrameCols(aCols, aSectRect.Height(), aSectRect.Height() - nDiffWidth, nLeftDiff ); + aSet.Put( aCols ); + } + SwSectionData aData(*pCurrSect); + rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet); } else - aSize.SetHeight(nHeight ); - - aSet.Put( aSize ); - rSh.SetFlyFrmAttr( aSet ); - } - else if( nFrmType == FRMTYPE_DRAWOBJ ) - { - SwRect aRect( rSh.GetObjRect() ); - aRect.Top( aLongULSpace.GetUpper() + rPageRect.Top() ); - aRect.Bottom( rPageRect.Bottom() - aLongULSpace.GetLower() ); - rSh.SetObjRect( aRect ) ; - } - else if(bVerticalWriting && (bSect || rSh.IsDirectlyInSection())) - { - //change the section indents and the columns if available - //at first determine the changes - SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0); - const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0); - aSectRect.Pos() += aTmpRect.Pos(); - const long nLeftDiff = aLongULSpace.GetUpper() - (long)(aSectRect.Top() - rPageRect.Top()); - const long nRightDiff = aLongULSpace.GetLower() - (long)(nPageHeight - aSectRect.Bottom() + rPageRect.Top()); - //change the LRSpaceItem of the section accordingly - const SwSection* pCurrSect = rSh.GetCurrSection(); - const SwSectionFmt* pSectFmt = pCurrSect->GetFmt(); - SvxLRSpaceItem aLR = pSectFmt->GetLRSpace(); - aLR.SetLeft(aLR.GetLeft() + nLeftDiff); - aLR.SetRight(aLR.GetRight() + nRightDiff); - SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L); - aSet.Put(aLR); - //change the first/last column - if(bSect) - { - SwFmtCol aCols( pSectFmt->GetCol() ); - long nDiffWidth = nLeftDiff + nRightDiff; - ::ResizeFrameCols(aCols, aSectRect.Height(), aSectRect.Height() - nDiffWidth, nLeftDiff ); - aSet.Put( aCols ); - } - SwSectionData aData(*pCurrSect); - rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet); - } - else - { SwPageDesc aDesc( rDesc ); + { SwPageDesc aDesc( rDesc ); if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER )) { @@ -536,10 +554,10 @@ void SwView::ExecTabWin( SfxRequest& rReq ) if( (bHead && pHeaderFmt) || (!bHead && pFooterFmt) ) { SwFmtFrmSize aSz( bHead ? pHeaderFmt->GetFrmSize() : - pFooterFmt->GetFrmSize() ); + pFooterFmt->GetFrmSize() ); aSz.SetHeightSizeType( ATT_FIX_SIZE ); aSz.SetHeight(nPageHeight - aLongULSpace.GetLower() - - aLongULSpace.GetUpper() ); + aLongULSpace.GetUpper() ); if ( bHead ) pHeaderFmt->SetFmtAttr( aSz ); else @@ -555,339 +573,440 @@ void SwView::ExecTabWin( SfxRequest& rReq ) } rSh.ChgPageDesc( nDescId, aDesc ); + } } - } - break; - case SID_ATTR_TABSTOP_VERTICAL: - case SID_ATTR_TABSTOP: - { - sal_uInt16 nWhich = GetPool().GetWhich(nSlot); - SvxTabStopItem aTabStops( (const SvxTabStopItem&)rReq.GetArgs()-> - Get( nWhich )); - aTabStops.SetWhich(RES_PARATR_TABSTOP); - const SvxTabStopItem& rDefTabs = - (const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP); - - // Default-Tab an Pos 0 - SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE ); - rSh.GetCurAttr( aSet ); - const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)aSet.Get(RES_LR_SPACE); - - if ( rLR.GetTxtFirstLineOfst() < 0 ) - { - SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT ); - aTabStops.Insert( aSwTabStop ); - } - - // auffuellen mit Default-Tabs - sal_uInt16 nDef = ::GetTabDist( rDefTabs ); - ::MakeDefTabs( nDef, aTabStops ); + break; - SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); - if( pColl && pColl->IsAutoUpdateFmt() ) + // apply new top and bottom margins to current page style + case SID_ATTR_PAGE_ULSPACE: { - SfxItemSet aTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP); - aTmp.Put(aTabStops); - rSh.AutoUpdatePara( pColl, aTmp ); + SvxLongULSpaceItem aLongULSpace( + static_cast<const SvxLongULSpaceItem&>(rReq.GetArgs()->Get( SID_ATTR_PAGE_ULSPACE ) ) ); + + SwPageDesc aDesc( rDesc ); + { + SvxULSpaceItem aUL(RES_UL_SPACE); + aUL.SetUpper((sal_uInt16)aLongULSpace.GetUpper()); + aUL.SetLower((sal_uInt16)aLongULSpace.GetLower()); + aDesc.GetMaster().SetFmtAttr(aUL); + } + rSh.ChgPageDesc( nDescId, aDesc ); } - else - rSh.SetAttr( aTabStops ); break; - } - case SID_ATTR_PARA_LRSPACE_VERTICAL: - case SID_ATTR_PARA_LRSPACE: - { - SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq. - GetArgs()->Get(nSlot)); - if(nFrmType & FRMTYPE_FLY_ANY) + + case SID_ATTR_PAGE_COLUMN: { - sal_Bool bFirstColumn = sal_True; - sal_Bool bLastColumn = sal_True; - if(nFrmType & FRMTYPE_COLUMN) + const SfxInt16Item aColumnItem( (const SfxInt16Item&)rReq.GetArgs()->Get(nSlot) ); + const sal_uInt16 nPageColumnType = aColumnItem.GetValue(); + + // nPageColumnType = + // 1 - single-columned page + // 2 - two-columned page + // 3 - three-columned page + // 4 - two-columned page with left column width of 2/3 of page width + // 5 - two-columned page with right column width of 2/3 of page width + + sal_uInt16 nCount = 2; + if ( nPageColumnType == 1 ) { - sal_uInt16 nCurFrameCol = rSh.GetCurColNum() - 1; - bFirstColumn = !nCurFrameCol; - const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt(); - const SwFmtCol* pCols = &pFmt->GetCol(); - const SwColumns& rCols = pCols->GetColumns(); - sal_uInt16 nColumnCount = rCols.Count(); - bLastColumn = nColumnCount == nCurFrameCol + 1; + nCount = 0; + } + else if ( nPageColumnType == 3 ) + { + nCount = 3; } - } - aParaMargin.SetRight( aParaMargin.GetRight() - nRightBorderDistance ); - aParaMargin.SetTxtLeft(aParaMargin.GetTxtLeft() - nLeftBorderDistance ); - aParaMargin.SetWhich( RES_LR_SPACE ); - SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); + const sal_uInt16 nGutterWidth = 0; + + const SvxLRSpaceItem aLR( rDesc.GetMaster().GetLRSpace() ); + const long nLeft = aLR.GetLeft(); + const long nRight = aLR.GetRight(); + const long nWidth = nPageWidth - nLeft - nRight; + + SwFmtCol aCols( rDesc.GetMaster().GetCol() ); + aCols.Init( nCount, nGutterWidth, nWidth ); + aCols.SetWishWidth( nWidth ); + aCols.SetGutterWidth( nGutterWidth, nWidth ); + aCols.SetOrtho( sal_False, nGutterWidth, nWidth ); - // #i23726# - if (pNumRuleNodeFromDoc) + long nColumnLeft = 0; + long nColumnRight = 0; + if ( nPageColumnType == 4 ) + { + nColumnRight = (long)(nWidth/3); + nColumnLeft = nWidth - nColumnRight; + aCols.GetColumns()[0]->SetWishWidth( nColumnLeft ); + aCols.GetColumns()[1]->SetWishWidth( nColumnRight ); + } + else if ( nPageColumnType == 5 ) + { + nColumnLeft = (long)(nWidth/3); + nColumnRight = nWidth - nColumnLeft; + aCols.GetColumns()[0]->SetWishWidth( nColumnLeft ); + aCols.GetColumns()[1]->SetWishWidth( nColumnRight ); + } + + SwPageDesc aDesc( rDesc ); + aDesc.GetMaster().SetFmtAttr( aCols ); + rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc ); + } + break; + + case SID_ATTR_TABSTOP_VERTICAL: + case SID_ATTR_TABSTOP: { - // --> FME 2005-02-22 #i42922# Mouse move of numbering label - // has to consider the left indent of the paragraph + sal_uInt16 nWhich = GetPool().GetWhich(nSlot); + SvxTabStopItem aTabStops( (const SvxTabStopItem&)rReq.GetArgs()-> + Get( nWhich )); + aTabStops.SetWhich(RES_PARATR_TABSTOP); + const SvxTabStopItem& rDefTabs = + (const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP); + + // Default-Tab an Pos 0 SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE ); rSh.GetCurAttr( aSet ); - const SvxLRSpaceItem& rLR = - static_cast<const SvxLRSpaceItem&>(aSet.Get(RES_LR_SPACE)); - // <-- - - SwPosition aPos(*pNumRuleNodeFromDoc); - // --> OD 2008-06-09 #i90078# - rSh.SetIndent( static_cast< short >(aParaMargin.GetTxtLeft() - rLR.GetTxtLeft()), aPos); - // <-- - // --> OD 2005-02-18 #i42921# - invalidate state of indent in order - // to get a ruler update. - aParaMargin.SetWhich( nSlot ); - GetViewFrame()->GetBindings().SetState( aParaMargin ); - // <-- - } - else if( pColl && pColl->IsAutoUpdateFmt() ) - { - SfxItemSet aSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE); - aSet.Put(aParaMargin); - rSh.AutoUpdatePara( pColl, aSet); + const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)aSet.Get(RES_LR_SPACE); + + if ( rLR.GetTxtFirstLineOfst() < 0 ) + { + SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT ); + aTabStops.Insert( aSwTabStop ); + } + + // auffuellen mit Default-Tabs + sal_uInt16 nDef = ::GetTabDist( rDefTabs ); + ::MakeDefTabs( nDef, aTabStops ); + + SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); + if( pColl && pColl->IsAutoUpdateFmt() ) + { + SfxItemSet aTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP); + aTmp.Put(aTabStops); + rSh.AutoUpdatePara( pColl, aTmp ); + } + else + rSh.SetAttr( aTabStops ); + break; } - else - rSh.SetAttr( aParaMargin ); - if ( aParaMargin.GetTxtFirstLineOfst() < 0 ) + case SID_ATTR_PARA_LRSPACE_VERTICAL: + case SID_ATTR_PARA_LRSPACE: { - SfxItemSet aSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP ); - - rSh.GetCurAttr( aSet ); - const SvxTabStopItem& rTabStops = (const SvxTabStopItem&)aSet.Get(RES_PARATR_TABSTOP); + SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq. + GetArgs()->Get(nSlot)); + if(nFrmType & FRMTYPE_FLY_ANY) + { + sal_Bool bFirstColumn = sal_True; + sal_Bool bLastColumn = sal_True; + if(nFrmType & FRMTYPE_COLUMN) + { + sal_uInt16 nCurFrameCol = rSh.GetCurColNum() - 1; + bFirstColumn = !nCurFrameCol; + const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt(); + const SwFmtCol* pCols = &pFmt->GetCol(); + const SwColumns& rCols = pCols->GetColumns(); + sal_uInt16 nColumnCount = rCols.Count(); + bLastColumn = nColumnCount == nCurFrameCol + 1; + } + } + aParaMargin.SetRight( aParaMargin.GetRight() - nRightBorderDistance ); + aParaMargin.SetTxtLeft(aParaMargin.GetTxtLeft() - nLeftBorderDistance ); - // Haben wir einen Tab an Stelle Null - sal_uInt16 i; + aParaMargin.SetWhich( RES_LR_SPACE ); + SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); - for ( i = 0; i < rTabStops.Count(); ++i ) - if ( rTabStops[i].GetTabPos() == 0 ) - break; + // #i23726# + if (pNumRuleNodeFromDoc) + { + // --> FME 2005-02-22 #i42922# Mouse move of numbering label + // has to consider the left indent of the paragraph + SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE ); + rSh.GetCurAttr( aSet ); + const SvxLRSpaceItem& rLR = + static_cast<const SvxLRSpaceItem&>(aSet.Get(RES_LR_SPACE)); + // <-- + + SwPosition aPos(*pNumRuleNodeFromDoc); + // --> OD 2008-06-09 #i90078# + rSh.SetIndent( static_cast< short >(aParaMargin.GetTxtLeft() - rLR.GetTxtLeft()), aPos); + // <-- + // --> OD 2005-02-18 #i42921# - invalidate state of indent in order + // to get a ruler update. + aParaMargin.SetWhich( nSlot ); + GetViewFrame()->GetBindings().SetState( aParaMargin ); + // <-- + } + else if( pColl && pColl->IsAutoUpdateFmt() ) + { + SfxItemSet aSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE); + aSet.Put(aParaMargin); + rSh.AutoUpdatePara( pColl, aSet); + } + else + rSh.SetAttr( aParaMargin ); - if ( i >= rTabStops.Count() ) + if ( aParaMargin.GetTxtFirstLineOfst() < 0 ) { - // Kein DefTab - SvxTabStopItem aTabStops( RES_PARATR_TABSTOP ); - aTabStops = rTabStops; + SfxItemSet aSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP ); - ::lcl_EraseDefTabs(aTabStops); + rSh.GetCurAttr( aSet ); + const SvxTabStopItem& rTabStops = (const SvxTabStopItem&)aSet.Get(RES_PARATR_TABSTOP); - SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT ); - aTabStops.Insert(aSwTabStop); + // Haben wir einen Tab an Stelle Null + sal_uInt16 i; - const SvxTabStopItem& rDefTabs = - (const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP); - sal_uInt16 nDef = ::GetTabDist(rDefTabs); - ::MakeDefTabs( nDef, aTabStops ); + for ( i = 0; i < rTabStops.Count(); ++i ) + if ( rTabStops[i].GetTabPos() == 0 ) + break; - if( pColl && pColl->IsAutoUpdateFmt()) + if ( i >= rTabStops.Count() ) { - SfxItemSet aSetTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP); - aSetTmp.Put(aTabStops); - rSh.AutoUpdatePara( pColl, aSetTmp ); + // Kein DefTab + SvxTabStopItem aTabStops( RES_PARATR_TABSTOP ); + aTabStops = rTabStops; + + ::lcl_EraseDefTabs(aTabStops); + + SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT ); + aTabStops.Insert(aSwTabStop); + + const SvxTabStopItem& rDefTabs = + (const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP); + sal_uInt16 nDef = ::GetTabDist(rDefTabs); + ::MakeDefTabs( nDef, aTabStops ); + + if( pColl && pColl->IsAutoUpdateFmt()) + { + SfxItemSet aSetTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP); + aSetTmp.Put(aTabStops); + rSh.AutoUpdatePara( pColl, aSetTmp ); + } + else + rSh.SetAttr( aTabStops ); } - else - rSh.SetAttr( aTabStops ); } } + break; + + case SID_ATTR_PARA_ULSPACE: + { + SvxULSpaceItem aParaMargin((const SvxULSpaceItem&)rReq. + GetArgs()->Get(nSlot)); + + long nUDist = 0; + long nLDist = 0; + aParaMargin.SetUpper( aParaMargin.GetUpper() - nUDist ); + aParaMargin.SetLower(aParaMargin.GetLower() - nLDist); + + aParaMargin.SetWhich( RES_UL_SPACE ); + SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); + if( pColl && pColl->IsAutoUpdateFmt() ) + { + SfxItemSet aSet(GetPool(), RES_UL_SPACE, RES_UL_SPACE); + aSet.Put(aParaMargin); + rSh.AutoUpdatePara( pColl, aSet); + } + else + rSh.SetAttr( aParaMargin ); } break; + case SID_RULER_BORDERS_VERTICAL: case SID_RULER_BORDERS: - { - SvxColumnItem aColItem((const SvxColumnItem&)rReq. - GetArgs()->Get(nSlot)); - - if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) ) { - ASSERT(aColItem.Count(), "ColDesc ist leer!!"); + SvxColumnItem aColItem((const SvxColumnItem&)rReq. + GetArgs()->Get(nSlot)); - const sal_Bool bSingleLine = ((const SfxBoolItem&)rReq. - GetArgs()->Get(SID_RULER_ACT_LINE_ONLY)).GetValue(); + if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) ) + { + ASSERT(aColItem.Count(), "ColDesc ist leer!!"); - SwTabCols aTabCols; - if ( bSetTabColFromDoc ) - rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos ); - else - rSh.GetTabCols(aTabCols); + const sal_Bool bSingleLine = ((const SfxBoolItem&)rReq. + GetArgs()->Get(SID_RULER_ACT_LINE_ONLY)).GetValue(); - // linker Tabellenrand - long nBorder = (long)(aColItem.GetLeft() - aTabCols.GetLeftMin()); - aTabCols.SetLeft( nBorder ); + SwTabCols aTabCols; + if ( bSetTabColFromDoc ) + rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos ); + else + rSh.GetTabCols(aTabCols); + + // linker Tabellenrand + long nBorder = (long)(aColItem.GetLeft() - aTabCols.GetLeftMin()); + aTabCols.SetLeft( nBorder ); - nBorder = (bVerticalWriting ? nPageHeight : nPageWidth) - aTabCols.GetLeftMin() - aColItem.GetRight(); + nBorder = (bVerticalWriting ? nPageHeight : nPageWidth) - aTabCols.GetLeftMin() - aColItem.GetRight(); #ifdef DEBUG - long nTmp1 = nPageWidth; - long nTmp2 = aTabCols.GetLeftMin() + nBorder; - (void)nTmp1; - (void)nTmp2; + long nTmp1 = nPageWidth; + long nTmp2 = aTabCols.GetLeftMin() + nBorder; + (void)nTmp1; + (void)nTmp2; #endif - if ( aColItem.GetRight() > 0 ) - aTabCols.SetRight( nBorder ); + if ( aColItem.GetRight() > 0 ) + aTabCols.SetRight( nBorder ); - // Tabcols der Reihe nach - // Die letzte Col wird durch den Rand definiert - //columns in right-to-left tables need to be mirrored - sal_Bool bIsTableRTL = - IsTabColFromDoc() ? - rSh.IsMouseTableRightToLeft(aTabColFromDocPos) + // Tabcols der Reihe nach + // Die letzte Col wird durch den Rand definiert + //columns in right-to-left tables need to be mirrored + sal_Bool bIsTableRTL = + IsTabColFromDoc() ? + rSh.IsMouseTableRightToLeft(aTabColFromDocPos) : rSh.IsTableRightToLeft(); - if(bIsTableRTL) - { - sal_uInt16 nColCount = aColItem.Count() - 1; - for ( sal_uInt16 i = 0; i < nColCount; ++i ) + if(bIsTableRTL) { - const SvxColumnDescription& rCol = aColItem[nColCount - i]; - aTabCols[i] = aTabCols.GetRight() - rCol.nStart; - aTabCols.SetHidden( i, !rCol.bVisible ); + sal_uInt16 nColCount = aColItem.Count() - 1; + for ( sal_uInt16 i = 0; i < nColCount; ++i ) + { + const SvxColumnDescription& rCol = aColItem[nColCount - i]; + aTabCols[i] = aTabCols.GetRight() - rCol.nStart; + aTabCols.SetHidden( i, !rCol.bVisible ); + } } - } - else - { - for ( sal_uInt16 i = 0; i < aColItem.Count()-1; ++i ) + else { - const SvxColumnDescription& rCol = aColItem[i]; - aTabCols[i] = rCol.nEnd + aTabCols.GetLeft(); - aTabCols.SetHidden( i, !rCol.bVisible ); + for ( sal_uInt16 i = 0; i < aColItem.Count()-1; ++i ) + { + const SvxColumnDescription& rCol = aColItem[i]; + aTabCols[i] = rCol.nEnd + aTabCols.GetLeft(); + aTabCols.SetHidden( i, !rCol.bVisible ); + } } - } - if ( bSetTabColFromDoc ) - { - if( !rSh.IsViewLocked() ) + if ( bSetTabColFromDoc ) { - bUnlockView = sal_True; - rSh.LockView( sal_True ); + if( !rSh.IsViewLocked() ) + { + bUnlockView = sal_True; + rSh.LockView( sal_True ); + } + rSh.SetMouseTabCols( aTabCols, bSingleLine, + aTabColFromDocPos ); } - rSh.SetMouseTabCols( aTabCols, bSingleLine, - aTabColFromDocPos ); + else + rSh.SetTabCols(aTabCols, bSingleLine); + } else - rSh.SetTabCols(aTabCols, bSingleLine); - - } - else - { - if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY || bSect) { - SwSectionFmt *pSectFmt = 0; - SfxItemSet aSet( GetPool(), RES_COL, RES_COL ); - if(bSect) - { - const SwSection *pSect = rSh.GetAnySection(); - ASSERT( pSect, "Welcher Bereich?"); - pSectFmt = pSect->GetFmt(); - } - else + if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY || bSect) { - rSh.GetFlyFrmAttr( aSet ); - } - SwFmtCol aCols( - bSect ? + SwSectionFmt *pSectFmt = 0; + SfxItemSet aSet( GetPool(), RES_COL, RES_COL ); + if(bSect) + { + const SwSection *pSect = rSh.GetAnySection(); + ASSERT( pSect, "Welcher Bereich?"); + pSectFmt = pSect->GetFmt(); + } + else + { + rSh.GetFlyFrmAttr( aSet ); + } + SwFmtCol aCols( + bSect ? pSectFmt->GetCol() : - (const SwFmtCol&)aSet.Get( RES_COL, sal_False )); - SwRect aCurRect = rSh.GetAnyCurRect(bSect ? RECT_SECTION_PRT : RECT_FLY_PRT_EMBEDDED); - const long lWidth = bVerticalWriting ? aCurRect.Height() : aCurRect.Width(); - ::lcl_ConvertToCols( aColItem, sal_uInt16(lWidth), aCols ); - aSet.Put( aCols ); - if(bSect) - rSh.SetSectionAttr( aSet, pSectFmt ); - else - { - rSh.StartAction(); - rSh.Push(); - rSh.SetFlyFrmAttr( aSet ); - //die Rahmenselektion wieder aufheben - if(!bFrmSelection && rSh.IsFrmSelected()) + (const SwFmtCol&)aSet.Get( RES_COL, sal_False )); + SwRect aCurRect = rSh.GetAnyCurRect(bSect ? RECT_SECTION_PRT : RECT_FLY_PRT_EMBEDDED); + const long lWidth = bVerticalWriting ? aCurRect.Height() : aCurRect.Width(); + ::lcl_ConvertToCols( aColItem, sal_uInt16(lWidth), aCols ); + aSet.Put( aCols ); + if(bSect) + rSh.SetSectionAttr( aSet, pSectFmt ); + else { - rSh.UnSelectFrm(); - rSh.LeaveSelFrmMode(); + rSh.StartAction(); + rSh.Push(); + rSh.SetFlyFrmAttr( aSet ); + //die Rahmenselektion wieder aufheben + if(!bFrmSelection && rSh.IsFrmSelected()) + { + rSh.UnSelectFrm(); + rSh.LeaveSelFrmMode(); + } + rSh.Pop(); + rSh.EndAction(); } - rSh.Pop(); - rSh.EndAction(); } - } - else - { - SwFmtCol aCols( rDesc.GetMaster().GetCol() ); - const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT); - ::lcl_ConvertToCols( aColItem, - sal_uInt16(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width()), - aCols ); - SwPageDesc aDesc( rDesc ); - aDesc.GetMaster().SetFmtAttr( aCols ); - rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc ); + else + { + SwFmtCol aCols( rDesc.GetMaster().GetCol() ); + const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT); + ::lcl_ConvertToCols( aColItem, + sal_uInt16(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width()), + aCols ); + SwPageDesc aDesc( rDesc ); + aDesc.GetMaster().SetFmtAttr( aCols ); + rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc ); + } } } - } - break; + break; case SID_RULER_ROWS : case SID_RULER_ROWS_VERTICAL: - { - SvxColumnItem aColItem((const SvxColumnItem&)rReq. - GetArgs()->Get(nSlot)); - - if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) ) { - ASSERT(aColItem.Count(), "ColDesc ist leer!!"); - - SwTabCols aTabCols; - if ( bSetTabRowFromDoc ) - rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos ); - else - rSh.GetTabRows(aTabCols); + SvxColumnItem aColItem((const SvxColumnItem&)rReq. + GetArgs()->Get(nSlot)); - if ( bVerticalWriting ) + if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) ) { - aTabCols.SetRight(nPageWidth - aColItem.GetRight() - aColItem.GetLeft()); - aTabCols.SetLeftMin(aColItem.GetLeft()); - } - else - { - long nBorder = nPageHeight - aTabCols.GetLeftMin() - aColItem.GetRight(); - aTabCols.SetRight( nBorder ); - } + ASSERT(aColItem.Count(), "ColDesc ist leer!!"); - if(bVerticalWriting) - { - for ( sal_uInt16 i = aColItem.Count() - 1; i; --i ) + SwTabCols aTabCols; + if ( bSetTabRowFromDoc ) + rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos ); + else + rSh.GetTabRows(aTabCols); + + if ( bVerticalWriting ) { - const SvxColumnDescription& rCol = aColItem[i - 1]; - long nColumnPos = aTabCols.GetRight() - rCol.nEnd ; - aTabCols[i - 1] = nColumnPos; - aTabCols.SetHidden( i - 1, !rCol.bVisible ); + aTabCols.SetRight(nPageWidth - aColItem.GetRight() - aColItem.GetLeft()); + aTabCols.SetLeftMin(aColItem.GetLeft()); } - } - else - { - for ( sal_uInt16 i = 0; i < aColItem.Count()-1; ++i ) + else { - const SvxColumnDescription& rCol = aColItem[i]; - aTabCols[i] = rCol.nEnd + aTabCols.GetLeft(); - aTabCols.SetHidden( i, !rCol.bVisible ); + long nBorder = nPageHeight - aTabCols.GetLeftMin() - aColItem.GetRight(); + aTabCols.SetRight( nBorder ); } - } - sal_Bool bSingleLine = sal_False; - const SfxPoolItem* pSingleLine; - if( SFX_ITEM_SET == rReq.GetArgs()->GetItemState(SID_RULER_ACT_LINE_ONLY, sal_False, &pSingleLine)) - bSingleLine = ((const SfxBoolItem*)pSingleLine)->GetValue(); - if ( bSetTabRowFromDoc ) - { - if( !rSh.IsViewLocked() ) + + if(bVerticalWriting) + { + for ( sal_uInt16 i = aColItem.Count() - 1; i; --i ) + { + const SvxColumnDescription& rCol = aColItem[i - 1]; + long nColumnPos = aTabCols.GetRight() - rCol.nEnd ; + aTabCols[i - 1] = nColumnPos; + aTabCols.SetHidden( i - 1, !rCol.bVisible ); + } + } + else + { + for ( sal_uInt16 i = 0; i < aColItem.Count()-1; ++i ) + { + const SvxColumnDescription& rCol = aColItem[i]; + aTabCols[i] = rCol.nEnd + aTabCols.GetLeft(); + aTabCols.SetHidden( i, !rCol.bVisible ); + } + } + sal_Bool bSingleLine = sal_False; + const SfxPoolItem* pSingleLine; + if( SFX_ITEM_SET == rReq.GetArgs()->GetItemState(SID_RULER_ACT_LINE_ONLY, sal_False, &pSingleLine)) + bSingleLine = ((const SfxBoolItem*)pSingleLine)->GetValue(); + if ( bSetTabRowFromDoc ) { - bUnlockView = sal_True; - rSh.LockView( sal_True ); + if( !rSh.IsViewLocked() ) + { + bUnlockView = sal_True; + rSh.LockView( sal_True ); + } + rSh.SetMouseTabRows( aTabCols, bSingleLine, aTabColFromDocPos ); } - rSh.SetMouseTabRows( aTabCols, bSingleLine, aTabColFromDocPos ); + else + rSh.SetTabRows(aTabCols, bSingleLine); } - else - rSh.SetTabRows(aTabCols, bSingleLine); } - } - break; + break; default: ASSERT( !this, "Falsche SlotId"); @@ -948,10 +1067,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) SfxItemSet aCoreSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP, RES_LR_SPACE, RES_UL_SPACE, 0 ); - // --> OD 2008-01-17 #newlistlevelattrs# // get also the list level indent values merged as LR-SPACE item, if needed. rSh.GetCurAttr( aCoreSet, true ); - // <-- SelectionType nSelType = rSh.GetSelectionType(); SfxWhichIter aIter( rSet ); @@ -962,891 +1079,972 @@ void SwView::StateTabWin(SfxItemSet& rSet) { switch ( nWhich ) { -// case RES_LR_SPACE: -// case SID_ATTR_LRSPACE: - case SID_ATTR_LONG_LRSPACE: - { - SvxLongLRSpaceItem aLongLR( (long)aPageLRSpace.GetLeft(), - (long)aPageLRSpace.GetRight(), - SID_ATTR_LONG_LRSPACE); - if(bBrowse) - { - aLongLR.SetLeft(rPagePrtRect.Left()); - aLongLR.SetRight(nPageWidth - rPagePrtRect.Right()); - } - if ( ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER ) && - !(nFrmType & FRMTYPE_COLSECT) ) + case SID_ATTR_PAGE_COLUMN: { - SwFrmFmt *pFmt = (SwFrmFmt*) (nFrmType & FRMTYPE_HEADER ? - rDesc.GetMaster().GetHeader().GetHeaderFmt() : - rDesc.GetMaster().GetFooter().GetFooterFmt()); - if( pFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash + sal_uInt16 nColumnType = 0; + + const SwFrmFmt& rMaster = rDesc.GetMaster(); + SwFmtCol aCol(rMaster.GetCol()); + const sal_uInt16 nCols = aCol.GetNumCols(); + if ( nCols == 0 ) { - SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt)); - aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos(); - const SvxLRSpaceItem& aLR = pFmt->GetLRSpace(); - aLongLR.SetLeft ( (long)aLR.GetLeft() + (long)aRect.Left() ); - aLongLR.SetRight( (nPageWidth - - (long)aRect.Right() + (long)aLR.GetRight())); + nColumnType = 1; } + else if ( nCols == 2 ) + { + const sal_uInt16 nColLeft = aCol.CalcPrtColWidth(0, aCol.GetWishWidth()); + const sal_uInt16 nColRight = aCol.CalcPrtColWidth(1, aCol.GetWishWidth()); + + if ( abs(nColLeft - nColRight) <= 10 ) + { + nColumnType = 2; + } + else if( abs(nColLeft - nColRight*2) < 20 ) + { + nColumnType = 4; + } + else if( abs(nColLeft*2 - nColRight) < 20 ) + { + nColumnType = 5; + } + } + else if( nCols == 3 ) + { + nColumnType = 3; + } + + rSet.Put( SfxInt16Item( SID_ATTR_PAGE_COLUMN, nColumnType ) ); } - else + break; + + case SID_ATTR_LONG_LRSPACE: { - SwRect aRect; - if( !bFrmSelection && ((nFrmType & FRMTYPE_COLSECT) || rSh.IsDirectlyInSection()) ) + SvxLongLRSpaceItem aLongLR( (long)aPageLRSpace.GetLeft(), + (long)aPageLRSpace.GetRight(), + SID_ATTR_LONG_LRSPACE); + if(bBrowse) + { + aLongLR.SetLeft(rPagePrtRect.Left()); + aLongLR.SetRight(nPageWidth - rPagePrtRect.Right()); + } + if ( ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER ) && + !(nFrmType & FRMTYPE_COLSECT) ) { - aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt); - const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt); - aRect.Pos() += aTmpRect.Pos(); + SwFrmFmt *pFmt = (SwFrmFmt*) (nFrmType & FRMTYPE_HEADER ? + rDesc.GetMaster().GetHeader().GetHeaderFmt() : + rDesc.GetMaster().GetFooter().GetFooterFmt()); + if( pFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash + { + SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt)); + aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos(); + const SvxLRSpaceItem& aLR = pFmt->GetLRSpace(); + aLongLR.SetLeft ( (long)aLR.GetLeft() + (long)aRect.Left() ); + aLongLR.SetRight( (nPageWidth - + (long)aRect.Right() + (long)aLR.GetRight())); + } } + else + { + SwRect aRect; + if( !bFrmSelection && ((nFrmType & FRMTYPE_COLSECT) || rSh.IsDirectlyInSection()) ) + { + aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt); + const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt); + aRect.Pos() += aTmpRect.Pos(); + } - else if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) - aRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt); - else if( nFrmType & FRMTYPE_DRAWOBJ) - aRect = rSh.GetObjRect(); + else if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) + aRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt); + else if( nFrmType & FRMTYPE_DRAWOBJ) + aRect = rSh.GetObjRect(); - if( aRect.Width() ) + if( aRect.Width() ) + { + // PAGES01 + // make relative to page position: + aLongLR.SetLeft ((long)( aRect.Left() - rPageRect.Left() )); + aLongLR.SetRight((long)( rPageRect.Right() - aRect.Right())); + } + } + if( nWhich == SID_ATTR_LONG_LRSPACE ) + rSet.Put( aLongLR ); + else { - // PAGES01 - // make relative to page position: - aLongLR.SetLeft ((long)( aRect.Left() - rPageRect.Left() )); - aLongLR.SetRight((long)( rPageRect.Right() - aRect.Right())); + SvxLRSpaceItem aLR( aLongLR.GetLeft(), + aLongLR.GetRight(), + 0, 0, + nWhich); + rSet.Put(aLR); } + break; } - if( nWhich == SID_ATTR_LONG_LRSPACE ) - rSet.Put( aLongLR ); - else + + // provide left and right margins of current page style + case SID_ATTR_PAGE_LRSPACE: { - SvxLRSpaceItem aLR( aLongLR.GetLeft(), - aLongLR.GetRight(), - 0, 0, - nWhich); - rSet.Put(aLR); + SvxLongLRSpaceItem aLongLR( + (long)aPageLRSpace.GetLeft(), + (long)aPageLRSpace.GetRight(), + SID_ATTR_PAGE_LRSPACE ); + rSet.Put( aLongLR ); } break; - } - case SID_ATTR_LONG_ULSPACE: -// case SID_ATTR_ULSPACE: -// case RES_UL_SPACE: - { - // Rand Seite Oben Unten - SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() ); - SvxLongULSpaceItem aLongUL( (long)aUL.GetUpper(), - (long)aUL.GetLower(), - SID_ATTR_LONG_ULSPACE); - if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) - { - // Dokumentkoordinaten Frame auf Seitenkoordinaten umbrechen - const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt); - aLongUL.SetUpper((sal_uInt16)(rRect.Top() - rPageRect.Top() )); - aLongUL.SetLower((sal_uInt16)(rPageRect.Bottom() - rRect.Bottom() )); - } - else if ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER ) - { - SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt)); - aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos(); - aLongUL.SetUpper( (sal_uInt16)aRect.Top() ); - aLongUL.SetLower( (sal_uInt16)(nPageHeight - aRect.Bottom()) ); - } - else if( nFrmType & FRMTYPE_DRAWOBJ) + case SID_ATTR_LONG_ULSPACE: { - const SwRect &rRect = rSh.GetObjRect(); - aLongUL.SetUpper((rRect.Top() - rPageRect.Top())); - aLongUL.SetLower((rPageRect.Bottom() - rRect.Bottom())); + // Rand Seite Oben Unten + SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() ); + SvxLongULSpaceItem aLongUL( (long)aUL.GetUpper(), + (long)aUL.GetLower(), + SID_ATTR_LONG_ULSPACE); + + if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) + { + // Dokumentkoordinaten Frame auf Seitenkoordinaten umbrechen + const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt); + aLongUL.SetUpper((sal_uInt16)(rRect.Top() - rPageRect.Top() )); + aLongUL.SetLower((sal_uInt16)(rPageRect.Bottom() - rRect.Bottom() )); + } + else if ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER ) + { + SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt)); + aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos(); + aLongUL.SetUpper( (sal_uInt16)aRect.Top() ); + aLongUL.SetLower( (sal_uInt16)(nPageHeight - aRect.Bottom()) ); + } + else if( nFrmType & FRMTYPE_DRAWOBJ) + { + const SwRect &rRect = rSh.GetObjRect(); + aLongUL.SetUpper((rRect.Top() - rPageRect.Top())); + aLongUL.SetLower((rPageRect.Bottom() - rRect.Bottom())); + } + else if(bBrowse) + { + aLongUL.SetUpper(rPagePrtRect.Top()); + aLongUL.SetLower(nPageHeight - rPagePrtRect.Bottom()); + } + if( nWhich == SID_ATTR_LONG_ULSPACE ) + rSet.Put( aLongUL ); + else + { + SvxULSpaceItem aULTmp((sal_uInt16)aLongUL.GetUpper(), + (sal_uInt16)aLongUL.GetLower(), + nWhich); + rSet.Put(aULTmp); + } + break; } - else if(bBrowse) + + // provide top and bottom margins of current page style + case SID_ATTR_PAGE_ULSPACE: { - aLongUL.SetUpper(rPagePrtRect.Top()); - aLongUL.SetLower(nPageHeight - rPagePrtRect.Bottom()); - } - if( nWhich == SID_ATTR_LONG_ULSPACE ) + const SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() ); + SvxLongULSpaceItem aLongUL( + (long)aUL.GetUpper(), + (long)aUL.GetLower(), + SID_ATTR_PAGE_ULSPACE ); + rSet.Put( aLongUL ); - else - { - SvxULSpaceItem aULTmp((sal_uInt16)aLongUL.GetUpper(), - (sal_uInt16)aLongUL.GetLower(), - nWhich); - rSet.Put(aULTmp); } break; - } + case SID_ATTR_TABSTOP_VERTICAL : case RES_PARATR_TABSTOP: - { - if ( ISA( SwWebView ) || - IsTabColFromDoc() || - IsTabRowFromDoc() || - ( nSelType & nsSelectionType::SEL_GRF) || + { + if ( ISA( SwWebView ) || + IsTabColFromDoc() || + IsTabRowFromDoc() || + ( nSelType & nsSelectionType::SEL_GRF) || (nSelType & nsSelectionType::SEL_FRM) || (nSelType & nsSelectionType::SEL_OLE) || SFX_ITEM_AVAILABLE > aCoreSet.GetItemState(RES_LR_SPACE)|| (!bVerticalWriting && (SID_ATTR_TABSTOP_VERTICAL == nWhich))|| (bVerticalWriting && (RES_PARATR_TABSTOP == nWhich)) - ) - rSet.DisableItem( nWhich ); - else - { - SvxTabStopItem aTabStops((const SvxTabStopItem&) - aCoreSet.Get( RES_PARATR_TABSTOP )); - - const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&) - rSh.GetDefault(RES_PARATR_TABSTOP); - - DBG_ASSERT(pHRuler, "warum ist das Lineal nicht da?"); - long nDefTabDist = ::GetTabDist(rDefTabs); - pHRuler->SetDefTabDist( nDefTabDist ); - pVRuler->SetDefTabDist( nDefTabDist ); - ::lcl_EraseDefTabs(aTabStops); - rSet.Put(aTabStops, nWhich); + ) + rSet.DisableItem( nWhich ); + else + { + SvxTabStopItem aTabStops((const SvxTabStopItem&) + aCoreSet.Get( RES_PARATR_TABSTOP )); + + const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&) + rSh.GetDefault(RES_PARATR_TABSTOP); + + DBG_ASSERT(pHRuler, "warum ist das Lineal nicht da?"); + long nDefTabDist = ::GetTabDist(rDefTabs); + pHRuler->SetDefTabDist( nDefTabDist ); + pVRuler->SetDefTabDist( nDefTabDist ); + ::lcl_EraseDefTabs(aTabStops); + rSet.Put(aTabStops, nWhich); + } + break; } - break; - } + case SID_ATTR_PARA_LRSPACE_VERTICAL: case SID_ATTR_PARA_LRSPACE: - { - if ( nSelType & nsSelectionType::SEL_GRF || + { + if ( nSelType & nsSelectionType::SEL_GRF || nSelType & nsSelectionType::SEL_FRM || nSelType & nsSelectionType::SEL_OLE || nFrmType == FRMTYPE_DRAWOBJ || (!bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich))|| (bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich)) ) - { - rSet.DisableItem(nWhich); - } - else - { - SvxLRSpaceItem aLR( RES_LR_SPACE ); - if ( !IsTabColFromDoc() ) { - aLR = (const SvxLRSpaceItem&)aCoreSet.Get(RES_LR_SPACE); - - // #i23726# - if (pNumRuleNodeFromDoc) + rSet.DisableItem(nWhich); + } + else + { + SvxLRSpaceItem aLR( RES_LR_SPACE ); + if ( !IsTabColFromDoc() ) { - short nOffset = static_cast< short >(aLR.GetTxtLeft() + - // --> FME 2005-02-22 #i42922# Mouse move of numbering label - // has to consider the left indent of the paragraph - pNumRuleNodeFromDoc->GetLeftMarginWithNum( sal_True ) ); - // <-- + aLR = (const SvxLRSpaceItem&)aCoreSet.Get(RES_LR_SPACE); - short nFLOffset; - pNumRuleNodeFromDoc->GetFirstLineOfsWithNum( nFLOffset ); + // #i23726# + if (pNumRuleNodeFromDoc) + { + short nOffset = static_cast< short >(aLR.GetTxtLeft() + + // --> FME 2005-02-22 #i42922# Mouse move of numbering label + // has to consider the left indent of the paragraph + pNumRuleNodeFromDoc->GetLeftMarginWithNum( sal_True ) ); + // <-- - aLR.SetLeft( nOffset + nFLOffset ); + short nFLOffset; + pNumRuleNodeFromDoc->GetFirstLineOfsWithNum( nFLOffset ); + + aLR.SetLeft( nOffset + nFLOffset ); + } } + aLR.SetWhich(nWhich); + rSet.Put(aLR); } - aLR.SetWhich(nWhich); - rSet.Put(aLR); + break; } - break; - } + + case SID_ATTR_PARA_ULSPACE: + { + SvxULSpaceItem aUL = (const SvxULSpaceItem&)aCoreSet.Get(RES_UL_SPACE); + aUL.SetWhich(nWhich); + + SfxItemState e = aCoreSet.GetItemState(RES_UL_SPACE); + if( e >= SFX_ITEM_AVAILABLE ) + rSet.Put( aUL ); + else + rSet.InvalidateItem(nWhich); + } + break; + case SID_RULER_BORDER_DISTANCE: - { - nLeftBorderDistance = 0; - nRightBorderDistance = 0; - if ( nSelType & nsSelectionType::SEL_GRF || + { + nLeftBorderDistance = 0; + nRightBorderDistance = 0; + if ( nSelType & nsSelectionType::SEL_GRF || nSelType & nsSelectionType::SEL_FRM || nSelType & nsSelectionType::SEL_OLE || nFrmType == FRMTYPE_DRAWOBJ ) - rSet.DisableItem(SID_RULER_BORDER_DISTANCE); - else - { - SvxLRSpaceItem aDistLR(SID_RULER_BORDER_DISTANCE); - if(nFrmType & FRMTYPE_FLY_ANY) + rSet.DisableItem(SID_RULER_BORDER_DISTANCE); + else { - if( IsTabColFromDoc() ) + SvxLRSpaceItem aDistLR(SID_RULER_BORDER_DISTANCE); + if(nFrmType & FRMTYPE_FLY_ANY) { - const SwRect& rFlyPrtRect = rSh.GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, pPt ); - aDistLR.SetLeft(rFlyPrtRect.Left()); - aDistLR.SetRight(rFlyPrtRect.Left()); + if( IsTabColFromDoc() ) + { + const SwRect& rFlyPrtRect = rSh.GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, pPt ); + aDistLR.SetLeft(rFlyPrtRect.Left()); + aDistLR.SetRight(rFlyPrtRect.Left()); + } + else + { + SfxItemSet aCoreSet2( GetPool(), + RES_BOX, RES_BOX, + SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); + SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); + aCoreSet.Put( aBoxInfo ); + rSh.GetFlyFrmAttr( aCoreSet ); + const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet.Get(RES_BOX); + aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT )); + aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT)); + + //add the paragraph border distance + SfxItemSet aCoreSet1( GetPool(), + RES_BOX, RES_BOX, + 0 ); + rSh.GetCurAttr( aCoreSet1 ); + const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSet1.Get(RES_BOX); + aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT )); + aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT)); + } + rSet.Put(aDistLR); + nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); + nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight()); } - else + else if ( IsTabColFromDoc() || + ( rSh.GetTableFmt() && !bFrmSelection && + !(nFrmType & FRMTYPE_COLSECT ) ) ) { SfxItemSet aCoreSet2( GetPool(), - RES_BOX, RES_BOX, - SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); + RES_BOX, RES_BOX, + SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); - aCoreSet.Put( aBoxInfo ); - rSh.GetFlyFrmAttr( aCoreSet ); - const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet.Get(RES_BOX); + aBoxInfo.SetTable(sal_False); + aBoxInfo.SetDist((sal_Bool) sal_True); + aCoreSet2.Put(aBoxInfo); + rSh.GetTabBorders( aCoreSet2 ); + const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet2.Get(RES_BOX); aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT )); aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT)); - //add the paragraph border distance + //add the border distance of the paragraph SfxItemSet aCoreSet1( GetPool(), - RES_BOX, RES_BOX, - 0 ); + RES_BOX, RES_BOX, + 0 ); rSh.GetCurAttr( aCoreSet1 ); const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSet1.Get(RES_BOX); aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT )); aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT)); + rSet.Put(aDistLR); + nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); + nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight()); } - rSet.Put(aDistLR); - nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); - nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight()); - } - else if ( IsTabColFromDoc() || - ( rSh.GetTableFmt() && !bFrmSelection && - !(nFrmType & FRMTYPE_COLSECT ) ) ) - { - SfxItemSet aCoreSet2( GetPool(), - RES_BOX, RES_BOX, - SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); - SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); - aBoxInfo.SetTable(sal_False); - aBoxInfo.SetDist((sal_Bool) sal_True); - aCoreSet2.Put(aBoxInfo); - rSh.GetTabBorders( aCoreSet2 ); - const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet2.Get(RES_BOX); - aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT )); - aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT)); - - //add the border distance of the paragraph - SfxItemSet aCoreSet1( GetPool(), - RES_BOX, RES_BOX, - 0 ); - rSh.GetCurAttr( aCoreSet1 ); - const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSet1.Get(RES_BOX); - aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT )); - aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT)); - rSet.Put(aDistLR); - nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); - nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight()); - } - else if ( !rSh.IsDirectlyInSection() ) - { - //get the page/header/footer border distance - const SwFrmFmt& rMaster = rDesc.GetMaster(); - const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetAttrSet().Get(RES_BOX); - aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT )); - aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT)); - - const SvxBoxItem* pBox = 0; - if(nFrmType & FRMTYPE_HEADER) + else if ( !rSh.IsDirectlyInSection() ) { - rMaster.GetHeader(); - const SwFmtHeader& rHeaderFmt = rMaster.GetHeader(); - SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt(); - if( pHeaderFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash - pBox = & (const SvxBoxItem&)pHeaderFmt->GetBox(); - } - else if(nFrmType & FRMTYPE_FOOTER ) - { - const SwFmtFooter& rFooterFmt = rMaster.GetFooter(); - SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt(); - if( pFooterFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash - pBox = & (const SvxBoxItem&)pFooterFmt->GetBox(); - } - if(pBox) - { - aDistLR.SetLeft((sal_uInt16)pBox->GetDistance(BOX_LINE_LEFT )); - aDistLR.SetRight((sal_uInt16)pBox->GetDistance(BOX_LINE_RIGHT)); - } + //get the page/header/footer border distance + const SwFrmFmt& rMaster = rDesc.GetMaster(); + const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetAttrSet().Get(RES_BOX); + aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT )); + aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT)); - //add the border distance of the paragraph - SfxItemSet aCoreSetTmp( GetPool(), - RES_BOX, RES_BOX, - SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); - rSh.GetCurAttr( aCoreSetTmp ); - const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSetTmp.Get(RES_BOX); - aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT )); - aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT)); - rSet.Put(aDistLR); - nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); - nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight()); + const SvxBoxItem* pBox = 0; + if(nFrmType & FRMTYPE_HEADER) + { + rMaster.GetHeader(); + const SwFmtHeader& rHeaderFmt = rMaster.GetHeader(); + SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt(); + if( pHeaderFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash + pBox = & (const SvxBoxItem&)pHeaderFmt->GetBox(); + } + else if(nFrmType & FRMTYPE_FOOTER ) + { + const SwFmtFooter& rFooterFmt = rMaster.GetFooter(); + SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt(); + if( pFooterFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash + pBox = & (const SvxBoxItem&)pFooterFmt->GetBox(); + } + if(pBox) + { + aDistLR.SetLeft((sal_uInt16)pBox->GetDistance(BOX_LINE_LEFT )); + aDistLR.SetRight((sal_uInt16)pBox->GetDistance(BOX_LINE_RIGHT)); + } + + //add the border distance of the paragraph + SfxItemSet aCoreSetTmp( GetPool(), + RES_BOX, RES_BOX, + SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); + rSh.GetCurAttr( aCoreSetTmp ); + const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSetTmp.Get(RES_BOX); + aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT )); + aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT)); + rSet.Put(aDistLR); + nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); + nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight()); + } } } - } - break; + break; + case SID_RULER_TEXT_RIGHT_TO_LEFT: - { - if ( nSelType & nsSelectionType::SEL_GRF || + { + if ( nSelType & nsSelectionType::SEL_GRF || nSelType & nsSelectionType::SEL_FRM || nSelType & nsSelectionType::SEL_OLE || nFrmType == FRMTYPE_DRAWOBJ) - rSet.DisableItem(nWhich); - else - { - sal_Bool bFlag = rSh.IsInRightToLeftText(); - rSet.Put(SfxBoolItem(nWhich, bFlag)); + rSet.DisableItem(nWhich); + else + { + sal_Bool bFlag = rSh.IsInRightToLeftText(); + rSet.Put(SfxBoolItem(nWhich, bFlag)); + } } - } - break; + break; + case SID_RULER_BORDERS_VERTICAL: case SID_RULER_BORDERS: - { - sal_Bool bFrameHasVerticalColumns(sal_False); { - sal_Bool bFrameRTL; - sal_Bool bFrameVertL2R; - bFrameHasVerticalColumns = rSh.IsFrmVertical(sal_False, bFrameRTL, bFrameVertL2R) && - bFrmSelection; - } - sal_Bool bHasTable = ( IsTabColFromDoc() || + sal_Bool bFrameHasVerticalColumns(sal_False); + { + sal_Bool bFrameRTL; + sal_Bool bFrameVertL2R; + bFrameHasVerticalColumns = rSh.IsFrmVertical(sal_False, bFrameRTL, bFrameVertL2R) && + bFrmSelection; + } + sal_Bool bHasTable = ( IsTabColFromDoc() || ( rSh.GetTableFmt() && !bFrmSelection && !(nFrmType & FRMTYPE_COLSECT ) ) ); - sal_Bool bTableVertical = bHasTable && rSh.IsTableVertical(); + sal_Bool bTableVertical = bHasTable && rSh.IsTableVertical(); - if( ( (SID_RULER_BORDERS_VERTICAL == nWhich) && + if( ( (SID_RULER_BORDERS_VERTICAL == nWhich) && ((bHasTable && !bTableVertical)|| - (!bVerticalWriting && !bFrmSelection && !bHasTable ) || (bFrmSelection && !bFrameHasVerticalColumns)) ) || - ((SID_RULER_BORDERS == nWhich) && + (!bVerticalWriting && !bFrmSelection && !bHasTable ) || (bFrmSelection && !bFrameHasVerticalColumns)) ) || + ((SID_RULER_BORDERS == nWhich) && ((bHasTable && bTableVertical)|| - (bVerticalWriting && !bFrmSelection&& !bHasTable) || bFrameHasVerticalColumns))) - rSet.DisableItem(nWhich); - else if ( bHasTable ) - { - SwTabCols aTabCols; - sal_uInt16 nNum; - if ( 0 != ( bSetTabColFromDoc = IsTabColFromDoc() ) ) - { - rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos ); - nNum = rSh.GetCurMouseTabColNum( aTabColFromDocPos ); - } - else + (bVerticalWriting && !bFrmSelection&& !bHasTable) || bFrameHasVerticalColumns))) + rSet.DisableItem(nWhich); + else if ( bHasTable ) { - rSh.GetTabCols( aTabCols ); - nNum = rSh.GetCurTabColNum(); - if(rSh.IsTableRightToLeft()) - nNum = aTabCols.Count() - nNum; - } + SwTabCols aTabCols; + sal_uInt16 nNum; + if ( 0 != ( bSetTabColFromDoc = IsTabColFromDoc() ) ) + { + rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos ); + nNum = rSh.GetCurMouseTabColNum( aTabColFromDocPos ); + } + else + { + rSh.GetTabCols( aTabCols ); + nNum = rSh.GetCurTabColNum(); + if(rSh.IsTableRightToLeft()) + nNum = aTabCols.Count() - nNum; + } - ASSERT(nNum <= aTabCols.Count(), "TabCol not found"); - const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft(); - const int nRgt = (sal_uInt16)(bTableVertical ? nPageHeight : nPageWidth) - - (aTabCols.GetLeftMin() + - aTabCols.GetRight()); + ASSERT(nNum <= aTabCols.Count(), "TabCol not found"); + const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft(); + const int nRgt = (sal_uInt16)(bTableVertical ? nPageHeight : nPageWidth) - + (aTabCols.GetLeftMin() + + aTabCols.GetRight()); - const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0); - const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0); + const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0); + const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0); - SvxColumnItem aColItem(nNum, nL, nR); + SvxColumnItem aColItem(nNum, nL, nR); - sal_uInt16 nStart = 0, - nEnd; + sal_uInt16 nStart = 0, + nEnd; - //columns in right-to-left tables need to be mirrored - sal_Bool bIsTableRTL = - IsTabColFromDoc() ? - rSh.IsMouseTableRightToLeft(aTabColFromDocPos) + //columns in right-to-left tables need to be mirrored + sal_Bool bIsTableRTL = + IsTabColFromDoc() ? + rSh.IsMouseTableRightToLeft(aTabColFromDocPos) : rSh.IsTableRightToLeft(); - if(bIsTableRTL) - { - for ( sal_uInt16 i = aTabCols.Count(); i ; --i ) + if(bIsTableRTL) { - const SwTabColsEntry& rEntry = aTabCols.GetEntry( i - 1 ); - nEnd = (sal_uInt16)aTabCols.GetRight(); - nEnd = nEnd - (sal_uInt16)rEntry.nPos; - SvxColumnDescription aColDesc( nStart, nEnd, - (sal_uInt16(aTabCols.GetRight() - rEntry.nMax)), - (sal_uInt16(aTabCols.GetRight() - rEntry.nMin)), - !aTabCols.IsHidden(i - 1) ); + for ( sal_uInt16 i = aTabCols.Count(); i ; --i ) + { + const SwTabColsEntry& rEntry = aTabCols.GetEntry( i - 1 ); + nEnd = (sal_uInt16)aTabCols.GetRight(); + nEnd = nEnd - (sal_uInt16)rEntry.nPos; + SvxColumnDescription aColDesc( nStart, nEnd, + (sal_uInt16(aTabCols.GetRight() - rEntry.nMax)), + (sal_uInt16(aTabCols.GetRight() - rEntry.nMin)), + !aTabCols.IsHidden(i - 1) ); + aColItem.Append(aColDesc); + nStart = nEnd; + } + SvxColumnDescription aColDesc(nStart, + aTabCols.GetRight() - aTabCols.GetLeft(), sal_True); aColItem.Append(aColDesc); - nStart = nEnd; } - SvxColumnDescription aColDesc(nStart, - aTabCols.GetRight() - aTabCols.GetLeft(), sal_True); - aColItem.Append(aColDesc); - } - else - { - for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i ) + else { - const SwTabColsEntry& rEntry = aTabCols.GetEntry( i ); - nEnd = static_cast< sal_uInt16 >(rEntry.nPos - aTabCols.GetLeft()); - SvxColumnDescription aColDesc( nStart, nEnd, + for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i ) + { + const SwTabColsEntry& rEntry = aTabCols.GetEntry( i ); + nEnd = static_cast< sal_uInt16 >(rEntry.nPos - aTabCols.GetLeft()); + SvxColumnDescription aColDesc( nStart, nEnd, rEntry.nMin - aTabCols.GetLeft(), rEntry.nMax - aTabCols.GetLeft(), - !aTabCols.IsHidden(i) ); + !aTabCols.IsHidden(i) ); + aColItem.Append(aColDesc); + nStart = nEnd; + } + SvxColumnDescription aColDesc(nStart, aTabCols.GetRight() - aTabCols.GetLeft(), + 0, 0, + sal_True); aColItem.Append(aColDesc); - nStart = nEnd; } - SvxColumnDescription aColDesc(nStart, aTabCols.GetRight() - aTabCols.GetLeft(), - 0, 0, - sal_True); - aColItem.Append(aColDesc); - } - rSet.Put(aColItem, nWhich); - } - else if ( bFrmSelection || nFrmType & ( FRMTYPE_COLUMN | FRMTYPE_COLSECT ) ) - { - // Aus Rahmen oder Seite ? - sal_uInt16 nNum = 0; - if(bFrmSelection) - { - const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt(); - if(pFmt) - nNum = pFmt->GetCol().GetNumCols(); + rSet.Put(aColItem, nWhich); } - else - nNum = rSh.GetCurColNum(); - - if( - //eigentlich sollte FRMTYPE_COLSECT nicht enthalten sein, wenn der Rahmen selektiert ist! - !bFrmSelection && - nFrmType & FRMTYPE_COLSECT ) + else if ( bFrmSelection || nFrmType & ( FRMTYPE_COLUMN | FRMTYPE_COLSECT ) ) { - const SwSection *pSect = rSh.GetAnySection(sal_False, pPt); - ASSERT( pSect, "Welcher Bereich?"); - if( pSect ) + // Aus Rahmen oder Seite ? + sal_uInt16 nNum = 0; + if(bFrmSelection) { - SwSectionFmt *pFmt = pSect->GetFmt(); - const SwFmtCol& rCol = pFmt->GetCol(); - if(rSh.IsInRightToLeftText()) - nNum = rCol.GetColumns().Count() - nNum; - else - --nNum; - SvxColumnItem aColItem(nNum); - SwRect aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt); - const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt); - - ::lcl_FillSvxColumn(rCol, sal_uInt16(bVerticalWriting ? aRect.Height() : aRect.Width()), aColItem, 0); + const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt(); + if(pFmt) + nNum = pFmt->GetCol().GetNumCols(); + } + else + nNum = rSh.GetCurColNum(); - if(bVerticalWriting) + if( + //eigentlich sollte FRMTYPE_COLSECT nicht enthalten sein, wenn der Rahmen selektiert ist! + !bFrmSelection && + nFrmType & FRMTYPE_COLSECT ) + { + const SwSection *pSect = rSh.GetAnySection(sal_False, pPt); + ASSERT( pSect, "Welcher Bereich?"); + if( pSect ) { - aRect.Pos() += Point(aTmpRect.Left(), aTmpRect.Top()); - aRect.Pos().Y() -= rPageRect.Top(); - aColItem.SetLeft ((sal_uInt16)(aRect.Top())); - aColItem.SetRight((sal_uInt16)(nPageHeight - aRect.Bottom() )); + SwSectionFmt *pFmt = pSect->GetFmt(); + const SwFmtCol& rCol = pFmt->GetCol(); + if(rSh.IsInRightToLeftText()) + nNum = rCol.GetColumns().Count() - nNum; + else + --nNum; + SvxColumnItem aColItem(nNum); + SwRect aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt); + const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt); + + ::lcl_FillSvxColumn(rCol, sal_uInt16(bVerticalWriting ? aRect.Height() : aRect.Width()), aColItem, 0); + + if(bVerticalWriting) + { + aRect.Pos() += Point(aTmpRect.Left(), aTmpRect.Top()); + aRect.Pos().Y() -= rPageRect.Top(); + aColItem.SetLeft ((sal_uInt16)(aRect.Top())); + aColItem.SetRight((sal_uInt16)(nPageHeight - aRect.Bottom() )); + } + else + { + aRect.Pos() += aTmpRect.Pos(); + + // PAGES01 + // make relative to page position: + aColItem.SetLeft ((sal_uInt16)( aRect.Left() - rPageRect.Left() )); + aColItem.SetRight((sal_uInt16)( rPageRect.Right() - aRect.Right())); + } + aColItem.SetOrtho(aColItem.CalcOrtho()); + + rSet.Put(aColItem, nWhich); } - else + } + else if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) + { + // Spalten in Rahmen + if ( nNum ) { - aRect.Pos() += aTmpRect.Pos(); - - // PAGES01 - // make relative to page position: - aColItem.SetLeft ((sal_uInt16)( aRect.Left() - rPageRect.Left() )); - aColItem.SetRight((sal_uInt16)( rPageRect.Right() - aRect.Right())); + const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt() ; + + const SwFmtCol& rCol = pFmt->GetCol(); + if(rSh.IsInRightToLeftText()) + nNum = rCol.GetColumns().Count() - nNum; + else + nNum--; + SvxColumnItem aColItem(nNum); + const SwRect &rSizeRect = rSh.GetAnyCurRect(RECT_FLY_PRT_EMBEDDED, pPt); + + sal_Bool bUseVertical = bFrameHasVerticalColumns || (!bFrmSelection && bVerticalWriting); + const long lWidth = bUseVertical ? rSizeRect.Height() : rSizeRect.Width(); + const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt); + long nDist2 = ((bUseVertical ? rRect.Height() : rRect.Width()) - lWidth) /2; + ::lcl_FillSvxColumn(rCol, sal_uInt16(lWidth), aColItem, nDist2); + + SfxItemSet aFrameSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE); + rSh.GetFlyFrmAttr( aFrameSet ); + + if(bUseVertical) + { + aColItem.SetLeft ((sal_uInt16)(rRect.Top()- rPageRect.Top())); + aColItem.SetRight((sal_uInt16)(nPageHeight + rPageRect.Top() - rRect.Bottom() )); + } + else + { + aColItem.SetLeft ((sal_uInt16)(rRect.Left() - rPageRect.Left() )); + aColItem.SetRight((sal_uInt16)(rPageRect.Right() - rRect.Right() )); + } + + aColItem.SetOrtho(aColItem.CalcOrtho()); + + rSet.Put(aColItem, nWhich); } - aColItem.SetOrtho(aColItem.CalcOrtho()); - - rSet.Put(aColItem, nWhich); + else + rSet.DisableItem(nWhich); } - } - else if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) - { - // Spalten in Rahmen - if ( nNum ) - { - const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt() ; - - const SwFmtCol& rCol = pFmt->GetCol(); - if(rSh.IsInRightToLeftText()) - nNum = rCol.GetColumns().Count() - nNum; + else + { // Spalten auf der Seite + const SwFrmFmt& rMaster = rDesc.GetMaster(); + SwFmtCol aCol(rMaster.GetCol()); + if(rFrameDir.GetValue() == FRMDIR_HORI_RIGHT_TOP) + nNum = aCol.GetColumns().Count() - nNum; else nNum--; - SvxColumnItem aColItem(nNum); - const SwRect &rSizeRect = rSh.GetAnyCurRect(RECT_FLY_PRT_EMBEDDED, pPt); - sal_Bool bUseVertical = bFrameHasVerticalColumns || (!bFrmSelection && bVerticalWriting); - const long lWidth = bUseVertical ? rSizeRect.Height() : rSizeRect.Width(); - const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt); - long nDist2 = ((bUseVertical ? rRect.Height() : rRect.Width()) - lWidth) /2; - ::lcl_FillSvxColumn(rCol, sal_uInt16(lWidth), aColItem, nDist2); - - SfxItemSet aFrameSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE); - rSh.GetFlyFrmAttr( aFrameSet ); - - if(bUseVertical) + SvxColumnItem aColItem(nNum); + const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT, pPt); + const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetFmtAttr(RES_BOX); + long nDist = rBox.GetDistance(); + ::lcl_FillSvxColumn(aCol, + sal_uInt16(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width() ), + aColItem, nDist); + + if(bBrowse) { - aColItem.SetLeft ((sal_uInt16)(rRect.Top()- rPageRect.Top())); - aColItem.SetRight((sal_uInt16)(nPageHeight + rPageRect.Top() - rRect.Bottom() )); + aColItem.SetLeft((sal_uInt16)rPagePrtRect.Left()); + aColItem.SetRight(sal_uInt16(nPageWidth - rPagePrtRect.Right())); } else { - aColItem.SetLeft ((sal_uInt16)(rRect.Left() - rPageRect.Left() )); - aColItem.SetRight((sal_uInt16)(rPageRect.Right() - rRect.Right() )); + aColItem.SetLeft (aPageLRSpace.GetLeft()); + aColItem.SetRight(aPageLRSpace.GetRight()); } - aColItem.SetOrtho(aColItem.CalcOrtho()); rSet.Put(aColItem, nWhich); } - else - rSet.DisableItem(nWhich); } else - { // Spalten auf der Seite - const SwFrmFmt& rMaster = rDesc.GetMaster(); - SwFmtCol aCol(rMaster.GetCol()); - if(rFrameDir.GetValue() == FRMDIR_HORI_RIGHT_TOP) - nNum = aCol.GetColumns().Count() - nNum; - else - nNum--; - - SvxColumnItem aColItem(nNum); - const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT, pPt); - const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetFmtAttr(RES_BOX); - long nDist = rBox.GetDistance(); - ::lcl_FillSvxColumn(aCol, - sal_uInt16(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width() ), - aColItem, nDist); - - if(bBrowse) - { - aColItem.SetLeft((sal_uInt16)rPagePrtRect.Left()); - aColItem.SetRight(sal_uInt16(nPageWidth - rPagePrtRect.Right())); - } - else - { - aColItem.SetLeft (aPageLRSpace.GetLeft()); - aColItem.SetRight(aPageLRSpace.GetRight()); - } - aColItem.SetOrtho(aColItem.CalcOrtho()); - - rSet.Put(aColItem, nWhich); - } + rSet.DisableItem(nWhich); + break; } - else - rSet.DisableItem(nWhich); - break; - } + case SID_RULER_ROWS : case SID_RULER_ROWS_VERTICAL: - { - sal_Bool bFrameHasVerticalColumns(sal_False); { - sal_Bool bFrameRTL; - sal_Bool bFrameVertL2R; - bFrameHasVerticalColumns = rSh.IsFrmVertical(sal_False, bFrameRTL, bFrameVertL2R) && - bFrmSelection; - } + sal_Bool bFrameHasVerticalColumns(sal_False); + { + sal_Bool bFrameRTL; + sal_Bool bFrameVertL2R; + bFrameHasVerticalColumns = rSh.IsFrmVertical(sal_False, bFrameRTL, bFrameVertL2R) && + bFrmSelection; + } - if( ( (SID_RULER_ROWS == nWhich) && + if( ( (SID_RULER_ROWS == nWhich) && ((!bVerticalWriting && !bFrmSelection) || (bFrmSelection && !bFrameHasVerticalColumns)) ) || - ((SID_RULER_ROWS_VERTICAL == nWhich) && + ((SID_RULER_ROWS_VERTICAL == nWhich) && ((bVerticalWriting && !bFrmSelection) || bFrameHasVerticalColumns))) - rSet.DisableItem(nWhich); - else if ( IsTabRowFromDoc() || + rSet.DisableItem(nWhich); + else if ( IsTabRowFromDoc() || ( rSh.GetTableFmt() && !bFrmSelection && !(nFrmType & FRMTYPE_COLSECT ) ) ) - { - SwTabCols aTabCols; - //no current value necessary - sal_uInt16 nNum = 0; - if ( 0 != ( bSetTabRowFromDoc = IsTabRowFromDoc() ) ) { - rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos ); - } - else - { - rSh.GetTabRows( aTabCols ); - } + SwTabCols aTabCols; + //no current value necessary + sal_uInt16 nNum = 0; + if ( 0 != ( bSetTabRowFromDoc = IsTabRowFromDoc() ) ) + { + rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos ); + } + else + { + rSh.GetTabRows( aTabCols ); + } -// ASSERT(nNum <= aTabCols.Count(), "TabCol not found"); - const int nLft = aTabCols.GetLeftMin(); - const int nRgt = (sal_uInt16)(bVerticalWriting ? nPageWidth : nPageHeight) - - (aTabCols.GetLeftMin() + - aTabCols.GetRight()); + // ASSERT(nNum <= aTabCols.Count(), "TabCol not found"); + const int nLft = aTabCols.GetLeftMin(); + const int nRgt = (sal_uInt16)(bVerticalWriting ? nPageWidth : nPageHeight) - + (aTabCols.GetLeftMin() + + aTabCols.GetRight()); - const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0); - const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0); + const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0); + const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0); - SvxColumnItem aColItem(nNum, nL, nR); + SvxColumnItem aColItem(nNum, nL, nR); - sal_uInt16 nStart = 0, - nEnd; + sal_uInt16 nStart = 0, + nEnd; - for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i ) - { - const SwTabColsEntry& rEntry = aTabCols.GetEntry( i ); - if(bVerticalWriting) - { - nEnd = sal_uInt16(aTabCols.GetRight() - rEntry.nPos); - SvxColumnDescription aColDesc( nStart, nEnd, - aTabCols.GetRight() - rEntry.nMax, aTabCols.GetRight() - rEntry.nMin, - !aTabCols.IsHidden(i) ); - aColItem.Append(aColDesc); - } - else + for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i ) { - nEnd = sal_uInt16(rEntry.nPos - aTabCols.GetLeft()); - SvxColumnDescription aColDesc( nStart, nEnd, + const SwTabColsEntry& rEntry = aTabCols.GetEntry( i ); + if(bVerticalWriting) + { + nEnd = sal_uInt16(aTabCols.GetRight() - rEntry.nPos); + SvxColumnDescription aColDesc( nStart, nEnd, + aTabCols.GetRight() - rEntry.nMax, aTabCols.GetRight() - rEntry.nMin, + !aTabCols.IsHidden(i) ); + aColItem.Append(aColDesc); + } + else + { + nEnd = sal_uInt16(rEntry.nPos - aTabCols.GetLeft()); + SvxColumnDescription aColDesc( nStart, nEnd, sal_uInt16(rEntry.nMin - aTabCols.GetLeft()), sal_uInt16(rEntry.nMax - aTabCols.GetLeft()), - !aTabCols.IsHidden(i) ); - aColItem.Append(aColDesc); + !aTabCols.IsHidden(i) ); + aColItem.Append(aColDesc); + } + nStart = nEnd; } - nStart = nEnd; + if(bVerticalWriting) + nEnd = static_cast< sal_uInt16 >(aTabCols.GetRight()); + else + nEnd = static_cast< sal_uInt16 >(aTabCols.GetLeft()); + // put a position protection when the last row cannot be moved + // due to a page break inside of a row + if(!aTabCols.IsLastRowAllowedToChange()) + bPutContentProtection = sal_True; + + SvxColumnDescription aColDesc( nStart, nEnd, + aTabCols.GetRight(), aTabCols.GetRight(), + sal_False ); + aColItem.Append(aColDesc); + + rSet.Put(aColItem, nWhich); } - if(bVerticalWriting) - nEnd = static_cast< sal_uInt16 >(aTabCols.GetRight()); else - nEnd = static_cast< sal_uInt16 >(aTabCols.GetLeft()); - // put a position protection when the last row cannot be moved - // due to a page break inside of a row - if(!aTabCols.IsLastRowAllowedToChange()) - bPutContentProtection = sal_True; - - SvxColumnDescription aColDesc( nStart, nEnd, - aTabCols.GetRight(), aTabCols.GetRight(), - sal_False ); - aColItem.Append(aColDesc); - - rSet.Put(aColItem, nWhich); + rSet.DisableItem(nWhich); } - else - rSet.DisableItem(nWhich); - } - break; + break; + case SID_RULER_PAGE_POS: - { - // PAGES01 - SvxPagePosSizeItem aPagePosSize( + { + // PAGES01 + SvxPagePosSizeItem aPagePosSize( Point( rPageRect.Left(), rPageRect.Top()) , nPageWidth, nPageHeight); - rSet.Put(aPagePosSize); - break; - } + rSet.Put(aPagePosSize); + break; + } + case SID_RULER_LR_MIN_MAX: - { - Rectangle aRectangle; - if( ( nFrmType & FRMTYPE_COLSECT ) && !IsTabColFromDoc() && - ( nFrmType & ( FRMTYPE_TABLE|FRMTYPE_COLUMN ) ) ) { - if( nFrmType & FRMTYPE_TABLE ) + Rectangle aRectangle; + if( ( nFrmType & FRMTYPE_COLSECT ) && !IsTabColFromDoc() && + ( nFrmType & ( FRMTYPE_TABLE|FRMTYPE_COLUMN ) ) ) { - const sal_uInt16 nNum = rSh.GetCurTabColNum(); - SwTabCols aTabCols; - rSh.GetTabCols( aTabCols ); - - const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft(); - const int nRgt = (sal_uInt16)nPageWidth -(aTabCols.GetLeftMin() + aTabCols.GetRight()); - - const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0); - const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0); - - aRectangle.Left() = nL; - if(nNum > 1) - aRectangle.Left() += aTabCols[nNum - 2]; - if(nNum) - aRectangle.Left() += MINLAY; - if(aTabCols.Count() <= nNum + 1 ) - aRectangle.Right() = nR; - else - aRectangle.Right() = nPageWidth - (nL + aTabCols[nNum + 1]); - - if(nNum < aTabCols.Count()) - aRectangle.Right() += MINLAY; - } - else - { - const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt(); - const SwFmtCol* pCols = pFmt ? &pFmt->GetCol(): - &rDesc.GetMaster().GetCol(); - const SwColumns& rCols = pCols->GetColumns(); - sal_uInt16 nNum = rSh.GetCurOutColNum(); - sal_uInt16 nCount = Min(sal_uInt16(nNum + 1), rCols.Count()); - const SwRect aRect( rSh.GetAnyCurRect( pFmt - ? RECT_FLY_PRT_EMBEDDED - : RECT_PAGE_PRT, pPt )); - const SwRect aAbsRect( rSh.GetAnyCurRect( pFmt - ? RECT_FLY_EMBEDDED - : RECT_PAGE, pPt )); - - //die Breite im Rahmen bzw. innerhalbe der Seitenraender - const sal_uInt16 nTotalWidth = (sal_uInt16)aRect.Width(); - //die gesamte Rahmenbreite - die Differenz ist der doppelte Abstand zum Rand - const sal_uInt16 nOuterWidth = (sal_uInt16)aAbsRect.Width(); - int nWidth = 0, - nStart = 0, - nEnd = 0; - aRectangle.Left() = 0; - for ( sal_uInt16 i = 0; i < nCount; ++i ) + if( nFrmType & FRMTYPE_TABLE ) { - SwColumn* pCol = rCols[i]; - nStart = pCol->GetLeft() + nWidth; - if(i == nNum - 2) - aRectangle.Left() = nStart; - nWidth += pCols->CalcColWidth( i, nTotalWidth ); - nEnd = nWidth - pCol->GetRight(); - } - aRectangle.Right() = rPageRect.Right() - nEnd; - aRectangle.Left() -= rPageRect.Left(); + const sal_uInt16 nNum = rSh.GetCurTabColNum(); + SwTabCols aTabCols; + rSh.GetTabCols( aTabCols ); + + const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft(); + const int nRgt = (sal_uInt16)nPageWidth -(aTabCols.GetLeftMin() + aTabCols.GetRight()); + + const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0); + const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0); + + aRectangle.Left() = nL; + if(nNum > 1) + aRectangle.Left() += aTabCols[nNum - 2]; + if(nNum) + aRectangle.Left() += MINLAY; + if(aTabCols.Count() <= nNum + 1 ) + aRectangle.Right() = nR; + else + aRectangle.Right() = nPageWidth - (nL + aTabCols[nNum + 1]); - if(nNum > 1) - { - aRectangle.Left() += MINLAY; - aRectangle.Left() += aRect.Left(); + if(nNum < aTabCols.Count()) + aRectangle.Right() += MINLAY; } - if(pFmt) //Bereich in Rahmen - hier darf man bis zum Rand - aRectangle.Left() = aRectangle.Right() = 0; else { - // das Rechteck an die richtige absolute Position verschieben - aRectangle.Left() += aAbsRect.Left(); - aRectangle.Right() -= aAbsRect.Left(); - // Abstand zur Umrandung mit einbeziehen - aRectangle.Right() -= (nOuterWidth - nTotalWidth) / 2; - } + const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt(); + const SwFmtCol* pCols = pFmt ? &pFmt->GetCol(): + &rDesc.GetMaster().GetCol(); + const SwColumns& rCols = pCols->GetColumns(); + sal_uInt16 nNum = rSh.GetCurOutColNum(); + sal_uInt16 nCount = Min(sal_uInt16(nNum + 1), rCols.Count()); + const SwRect aRect( rSh.GetAnyCurRect( pFmt + ? RECT_FLY_PRT_EMBEDDED + : RECT_PAGE_PRT, pPt )); + const SwRect aAbsRect( rSh.GetAnyCurRect( pFmt + ? RECT_FLY_EMBEDDED + : RECT_PAGE, pPt )); + + //die Breite im Rahmen bzw. innerhalbe der Seitenraender + const sal_uInt16 nTotalWidth = (sal_uInt16)aRect.Width(); + //die gesamte Rahmenbreite - die Differenz ist der doppelte Abstand zum Rand + const sal_uInt16 nOuterWidth = (sal_uInt16)aAbsRect.Width(); + int nWidth = 0, + nStart = 0, + nEnd = 0; + aRectangle.Left() = 0; + for ( sal_uInt16 i = 0; i < nCount; ++i ) + { + SwColumn* pCol = rCols[i]; + nStart = pCol->GetLeft() + nWidth; + if(i == nNum - 2) + aRectangle.Left() = nStart; + nWidth += pCols->CalcColWidth( i, nTotalWidth ); + nEnd = nWidth - pCol->GetRight(); + } + aRectangle.Right() = rPageRect.Right() - nEnd; + aRectangle.Left() -= rPageRect.Left(); - if(nNum < rCols.Count()) - { - aRectangle.Right() += MINLAY; - } - else - // rechts ist jetzt nur noch der Seitenrand - aRectangle.Right() = 0; + if(nNum > 1) + { + aRectangle.Left() += MINLAY; + aRectangle.Left() += aRect.Left(); + } + if(pFmt) //Bereich in Rahmen - hier darf man bis zum Rand + aRectangle.Left() = aRectangle.Right() = 0; + else + { + // das Rechteck an die richtige absolute Position verschieben + aRectangle.Left() += aAbsRect.Left(); + aRectangle.Right() -= aAbsRect.Left(); + // Abstand zur Umrandung mit einbeziehen + aRectangle.Right() -= (nOuterWidth - nTotalWidth) / 2; + } + + if(nNum < rCols.Count()) + { + aRectangle.Right() += MINLAY; + } + else + // rechts ist jetzt nur noch der Seitenrand + aRectangle.Right() = 0; + } } - } - else if ( ((nFrmType & FRMTYPE_TABLE) || IsTabColFromDoc()) && - !bFrmSelection ) - { - sal_Bool bColumn; - if ( IsTabColFromDoc() ) - bColumn = rSh.GetCurMouseColNum( aTabColFromDocPos ) != 0; - else - bColumn = (nFrmType & (FRMTYPE_COLUMN|FRMTYPE_FLY_ANY| - FRMTYPE_COLSECTOUTTAB)) ? - sal_True : sal_False; - if ( !bColumn ) + else if ( ((nFrmType & FRMTYPE_TABLE) || IsTabColFromDoc()) && + !bFrmSelection ) { - if( nFrmType & FRMTYPE_FLY_ANY && IsTabColFromDoc() ) + sal_Bool bColumn; + if ( IsTabColFromDoc() ) + bColumn = rSh.GetCurMouseColNum( aTabColFromDocPos ) != 0; + else + bColumn = (nFrmType & (FRMTYPE_COLUMN|FRMTYPE_FLY_ANY|FRMTYPE_COLSECTOUTTAB)) + ? sal_True + : sal_False; + if ( !bColumn ) { - SwRect aRect( rSh.GetAnyCurRect( - RECT_FLY_PRT_EMBEDDED, pPt ) ); - aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED, - pPt ).Pos(); + if( nFrmType & FRMTYPE_FLY_ANY && IsTabColFromDoc() ) + { + SwRect aRect( rSh.GetAnyCurRect( + RECT_FLY_PRT_EMBEDDED, pPt ) ); + aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED, + pPt ).Pos(); - aRectangle.Left() = aRect.Left() - rPageRect.Left(); - aRectangle.Right() = rPageRect.Right() - aRect.Right(); - } - else if( bBrowse ) - { - aRectangle.Left() = rPagePrtRect.Left(); - aRectangle.Right() = nPageWidth - rPagePrtRect.Right(); + aRectangle.Left() = aRect.Left() - rPageRect.Left(); + aRectangle.Right() = rPageRect.Right() - aRect.Right(); + } + else if( bBrowse ) + { + aRectangle.Left() = rPagePrtRect.Left(); + aRectangle.Right() = nPageWidth - rPagePrtRect.Right(); + } + else + { + aRectangle.Left() = aPageLRSpace.GetLeft(); + aRectangle.Right() = aPageLRSpace.GetRight(); + } } else - { - aRectangle.Left() = aPageLRSpace.GetLeft(); - aRectangle.Right() = aPageLRSpace.GetRight(); - } - } - else - { //hier nur fuer Tabelle in mehrspaltigen Seiten und Rahmen - sal_Bool bSectOutTbl = (nFrmType & FRMTYPE_TABLE) ? sal_True : sal_False; - sal_Bool bFrame = (nFrmType & FRMTYPE_FLY_ANY) ? sal_True : sal_False; - sal_Bool bColSct = (nFrmType & ( bSectOutTbl - ? FRMTYPE_COLSECTOUTTAB - : FRMTYPE_COLSECT ) - ) ? sal_True : sal_False; - //Damit man auch mit der Mouse ziehen kann, - //ohne in der Tabelle zu stehen - CurRectType eRecType = RECT_PAGE_PRT; - sal_uInt16 nNum = IsTabColFromDoc() ? - rSh.GetCurMouseColNum( aTabColFromDocPos ): - rSh.GetCurOutColNum(); - const SwFrmFmt* pFmt = NULL; - if( bColSct ) - { - eRecType = bSectOutTbl ? RECT_OUTTABSECTION - : RECT_SECTION; - const SwSection *pSect = rSh.GetAnySection( bSectOutTbl, pPt ); - ASSERT( pSect, "Welcher Bereich?"); - pFmt = pSect->GetFmt(); - } - else if( bFrame ) - { - pFmt = rSh.GetFlyFrmFmt(); - eRecType = RECT_FLY_PRT_EMBEDDED; - } + { //hier nur fuer Tabelle in mehrspaltigen Seiten und Rahmen + sal_Bool bSectOutTbl = (nFrmType & FRMTYPE_TABLE) ? sal_True : sal_False; + sal_Bool bFrame = (nFrmType & FRMTYPE_FLY_ANY) ? sal_True : sal_False; + sal_Bool bColSct = (nFrmType & ( bSectOutTbl + ? FRMTYPE_COLSECTOUTTAB + : FRMTYPE_COLSECT ) + ) ? sal_True : sal_False; + //Damit man auch mit der Mouse ziehen kann, + //ohne in der Tabelle zu stehen + CurRectType eRecType = RECT_PAGE_PRT; + sal_uInt16 nNum = IsTabColFromDoc() ? + rSh.GetCurMouseColNum( aTabColFromDocPos ): + rSh.GetCurOutColNum(); + const SwFrmFmt* pFmt = NULL; + if( bColSct ) + { + eRecType = bSectOutTbl ? RECT_OUTTABSECTION + : RECT_SECTION; + const SwSection *pSect = rSh.GetAnySection( bSectOutTbl, pPt ); + ASSERT( pSect, "Welcher Bereich?"); + pFmt = pSect->GetFmt(); + } + else if( bFrame ) + { + pFmt = rSh.GetFlyFrmFmt(); + eRecType = RECT_FLY_PRT_EMBEDDED; + } - const SwFmtCol* pCols = pFmt ? &pFmt->GetCol(): - &rDesc.GetMaster().GetCol(); - const SwColumns& rCols = pCols->GetColumns(); - const sal_uInt16 nBorder = pFmt ? pFmt->GetBox().GetDistance() : - rDesc.GetMaster().GetBox().GetDistance(); + const SwFmtCol* pCols = pFmt ? &pFmt->GetCol(): + &rDesc.GetMaster().GetCol(); + const SwColumns& rCols = pCols->GetColumns(); + const sal_uInt16 nBorder = pFmt ? pFmt->GetBox().GetDistance() : + rDesc.GetMaster().GetBox().GetDistance(); - /* RECT_FLY_PRT_EMBEDDED returns the relative position to + /* RECT_FLY_PRT_EMBEDDED returns the relative position to RECT_FLY_EMBEDDED the absolute position must be added here - */ - SwRect aRect( rSh.GetAnyCurRect( eRecType, pPt ) ); - if(RECT_FLY_PRT_EMBEDDED == eRecType) - aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED, - pPt ).Pos(); - - const sal_uInt16 nTotalWidth = (sal_uInt16)aRect.Width(); - //nStart und nEnd initialisieren fuer nNum == 0 - int nWidth = 0, - nStart = 0, - nEnd = nTotalWidth; - - if( nNum > rCols.Count() ) - { - ASSERT( !this, "es wird auf dem falschen FmtCol gearbeitet!" ); - nNum = rCols.Count(); - } + */ + SwRect aRect( rSh.GetAnyCurRect( eRecType, pPt ) ); + if(RECT_FLY_PRT_EMBEDDED == eRecType) + aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED, + pPt ).Pos(); + + const sal_uInt16 nTotalWidth = (sal_uInt16)aRect.Width(); + //nStart und nEnd initialisieren fuer nNum == 0 + int nWidth = 0, + nStart = 0, + nEnd = nTotalWidth; + + if( nNum > rCols.Count() ) + { + ASSERT( !this, "es wird auf dem falschen FmtCol gearbeitet!" ); + nNum = rCols.Count(); + } - for( sal_uInt16 i = 0; i < nNum; ++i ) - { - SwColumn* pCol = rCols[i]; - nStart = pCol->GetLeft() + nWidth; - nWidth += pCols->CalcColWidth( i, nTotalWidth ); - nEnd = nWidth - pCol->GetRight(); - } - if( bFrame | bColSct ) - { - aRectangle.Left() = aRect.Left() - rPageRect.Left() + nStart; - aRectangle.Right() = nPageWidth - aRectangle.Left() - nEnd + nStart; - } - else if(!bBrowse) - { - aRectangle.Left() = aPageLRSpace.GetLeft() + nStart; - aRectangle.Right() = nPageWidth - nEnd - aPageLRSpace.GetLeft(); - } - else - { - long nLeft = rPagePrtRect.Left(); - aRectangle.Left() = nStart + nLeft; - aRectangle.Right() = nPageWidth - nEnd - nLeft; - } - if(!bFrame) - { - aRectangle.Left() += nBorder; - aRectangle.Right() -= nBorder; + for( sal_uInt16 i = 0; i < nNum; ++i ) + { + SwColumn* pCol = rCols[i]; + nStart = pCol->GetLeft() + nWidth; + nWidth += pCols->CalcColWidth( i, nTotalWidth ); + nEnd = nWidth - pCol->GetRight(); + } + if( bFrame | bColSct ) + { + aRectangle.Left() = aRect.Left() - rPageRect.Left() + nStart; + aRectangle.Right() = nPageWidth - aRectangle.Left() - nEnd + nStart; + } + else if(!bBrowse) + { + aRectangle.Left() = aPageLRSpace.GetLeft() + nStart; + aRectangle.Right() = nPageWidth - nEnd - aPageLRSpace.GetLeft(); + } + else + { + long nLeft = rPagePrtRect.Left(); + aRectangle.Left() = nStart + nLeft; + aRectangle.Right() = nPageWidth - nEnd - nLeft; + } + if(!bFrame) + { + aRectangle.Left() += nBorder; + aRectangle.Right() -= nBorder; + } } } + else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER )) + { + aRectangle.Left() = aPageLRSpace.GetLeft(); + aRectangle.Right() = aPageLRSpace.GetRight(); + } + else + aRectangle.Left() = aRectangle.Right() = 0; + + SfxRectangleItem aLR( SID_RULER_LR_MIN_MAX , aRectangle); + rSet.Put(aLR); } - else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER )) - { - aRectangle.Left() = aPageLRSpace.GetLeft(); - aRectangle.Right() = aPageLRSpace.GetRight(); - } - else - aRectangle.Left() = aRectangle.Right() = 0; + break; - SfxRectangleItem aLR( SID_RULER_LR_MIN_MAX , aRectangle); - rSet.Put(aLR); - } - break; case SID_RULER_PROTECT: - { - if(bFrmSelection) { - sal_uInt8 nProtect = pWrtShell->IsSelObjProtected( FLYPROTECT_SIZE|FLYPROTECT_POS|FLYPROTECT_CONTENT ); + if(bFrmSelection) + { + sal_uInt8 nProtect = pWrtShell->IsSelObjProtected( FLYPROTECT_SIZE|FLYPROTECT_POS|FLYPROTECT_CONTENT ); - SvxProtectItem aProt(SID_RULER_PROTECT); - aProt.SetCntntProtect((nProtect & FLYPROTECT_CONTENT) != 0); - aProt.SetSizeProtect ((nProtect & FLYPROTECT_SIZE) != 0); - aProt.SetPosProtect ((nProtect & FLYPROTECT_POS) != 0); - rSet.Put(aProt); - } - else - { - SvxProtectItem aProtect(SID_RULER_PROTECT); - if(bBrowse && !(nFrmType & (FRMTYPE_DRAWOBJ|FRMTYPE_COLUMN)) && !rSh.GetTableFmt()) + SvxProtectItem aProt(SID_RULER_PROTECT); + aProt.SetCntntProtect((nProtect & FLYPROTECT_CONTENT) != 0); + aProt.SetSizeProtect ((nProtect & FLYPROTECT_SIZE) != 0); + aProt.SetPosProtect ((nProtect & FLYPROTECT_POS) != 0); + rSet.Put(aProt); + } + else { - aProtect.SetSizeProtect(sal_True); - aProtect.SetPosProtect(sal_True); + SvxProtectItem aProtect(SID_RULER_PROTECT); + if(bBrowse && !(nFrmType & (FRMTYPE_DRAWOBJ|FRMTYPE_COLUMN)) && !rSh.GetTableFmt()) + { + aProtect.SetSizeProtect(sal_True); + aProtect.SetPosProtect(sal_True); + } + rSet.Put(aProtect); } - rSet.Put(aProtect); } - } - break; + break; } nWhich = aIter.NextWhich(); } diff --git a/sw/source/ui/uno/unofreg.cxx b/sw/source/ui/uno/unofreg.cxx index 9769650a5b0e..fb5d73a599d9 100644 --- a/sw/source/ui/uno/unofreg.cxx +++ b/sw/source/ui/uno/unofreg.cxx @@ -124,7 +124,6 @@ extern uno::Sequence< OUString > SAL_CALL SwXMailMerge_getSupportedServiceNames( extern OUString SAL_CALL SwXMailMerge_getImplementationName() throw(); extern uno::Reference< uno::XInterface > SAL_CALL SwXMailMerge_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception ); -// --> OD 2007-05-24 #i73788# #include "cppuhelper/implementationentry.hxx" namespace comp_FinalThreadManager { @@ -135,7 +134,8 @@ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL _crea com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context ); } -// <-- + +#include "SwPanelFactory.hxx" // #ifdef __cplusplus @@ -356,14 +356,19 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( SwUnoModule_createInstance, SwUnoModule_getSupportedServiceNames() ); } - // --> OD 2007-05-24 #i73788# + else if ( ::sw::sidebar::SwPanelFactory::getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) ) + { + xFactory = ::cppu::createSingleFactory( xMSF, + ::sw::sidebar::SwPanelFactory::getImplementationName(), + ::sw::sidebar::SwPanelFactory::createInstance, + ::sw::sidebar::SwPanelFactory::getSupportedServiceNames() ); + } else if( comp_FinalThreadManager::_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) ) { pRet = ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, entries); } - // <-- if( xFactory.is()) { diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx index 8e0d414bfee5..9308c79afafa 100644 --- a/sw/source/ui/utlui/navipi.cxx +++ b/sw/source/ui/utlui/navipi.cxx @@ -283,18 +283,18 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox ) break; case FN_SHOW_CONTENT_BOX: case FN_SELECT_CONTENT: - if(pContextWin->GetFloatingWindow()) - { - if(_IsZoomedIn() ) - { - _ZoomOut(); - } - else + if(pContextWin!=NULL && pContextWin->GetFloatingWindow()!=NULL) { - _ZoomIn(); + if(_IsZoomedIn() ) + { + _ZoomOut(); + } + else + { + _ZoomIn(); + } } - } - return sal_True; + return sal_True; //break; // Funktionen, die eine direkte Aktion ausloesen @@ -624,7 +624,7 @@ void SwNavigationPI::MakeMark() void SwNavigationPI::GotoPage() { - if ( pContextWin->GetFloatingWindow() && pContextWin->GetFloatingWindow()->IsRollUp()) + if (pContextWin && pContextWin->GetFloatingWindow() && pContextWin->GetFloatingWindow()->IsRollUp()) _ZoomIn(); if(IsGlobalMode()) ToggleTree(); @@ -640,14 +640,15 @@ void SwNavigationPI::_ZoomOut() { if (_IsZoomedIn()) { - FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); + FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL; bIsZoomedIn = sal_False; Size aSz(GetOutputSizePixel()); aSz.Height() = nZoomOut; Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel(); ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size( aMinOutSizePixel.Width(),nZoomOutInit)); - pFloat->SetOutputSizePixel(aSz); + if (pFloat != NULL) + pFloat->SetOutputSizePixel(aSz); FillBox(); if(IsGlobalMode()) { @@ -672,28 +673,31 @@ void SwNavigationPI::_ZoomOut() void SwNavigationPI::_ZoomIn() { - FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); - if (pFloat && - (!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp()))) + if (pContextWin != NULL) { - aContentTree.HideTree(); - aDocListBox.Hide(); - aGlobalTree.HideTree(); - bIsZoomedIn = sal_True; - Size aSz(GetOutputSizePixel()); - if( aSz.Height() > nZoomIn ) - nZoomOut = ( short ) aSz.Height(); - - aSz.Height() = nZoomIn; - Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel(); - ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size( - aMinOutSizePixel.Width(), aSz.Height())); - pFloat->SetOutputSizePixel(aSz); - SvLBoxEntry* pFirst = aContentTree.FirstSelected(); - if(pFirst) - aContentTree.Select(pFirst, sal_True); // toolbox enablen - pConfig->SetSmall( sal_True ); - aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_False); + FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); + if (pFloat && + (!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp()))) + { + aContentTree.HideTree(); + aDocListBox.Hide(); + aGlobalTree.HideTree(); + bIsZoomedIn = sal_True; + Size aSz(GetOutputSizePixel()); + if( aSz.Height() > nZoomIn ) + nZoomOut = ( short ) aSz.Height(); + + aSz.Height() = nZoomIn; + Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel(); + ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size( + aMinOutSizePixel.Width(), aSz.Height())); + pFloat->SetOutputSizePixel(aSz); + SvLBoxEntry* pFirst = aContentTree.FirstSelected(); + if(pFirst) + aContentTree.Select(pFirst, sal_True); // toolbox enablen + pConfig->SetSmall( sal_True ); + aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_False); + } } } /*------------------------------------------------------------------------ @@ -703,25 +707,29 @@ void SwNavigationPI::_ZoomIn() void SwNavigationPI::Resize() { Window* pParent = GetParent(); - FloatingWindow* pFloat = ((DockingWindow*)pParent)->GetFloatingWindow(); - Size aNewSize; if( !_IsZoomedIn() ) { - //change the minimum width depending on the dock status - Size aMinOutSizePixel = ((SfxDockingWindow*)pParent)->GetMinOutputSizePixel(); - if( pFloat) - { - aNewSize = pFloat->GetOutputSizePixel(); - aMinOutSizePixel.Width() = nWishWidth; - aMinOutSizePixel.Height() = _IsZoomedIn() ? nZoomIn : nZoomOutInit; - } - else + Size aNewSize (pParent->GetOutputSizePixel()); + + SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pParent); + if (pDockingParent != NULL) { - aNewSize = pParent->GetOutputSizePixel(); - aMinOutSizePixel.Width() = 0; - aMinOutSizePixel.Height() = 0; + FloatingWindow* pFloat = pDockingParent->GetFloatingWindow(); + //change the minimum width depending on the dock status + Size aMinOutSizePixel = pDockingParent->GetMinOutputSizePixel(); + if( pFloat) + { + aNewSize = pFloat->GetOutputSizePixel(); + aMinOutSizePixel.Width() = nWishWidth; + aMinOutSizePixel.Height() = _IsZoomedIn() ? nZoomIn : nZoomOutInit; + } + else + { + aMinOutSizePixel.Width() = 0; + aMinOutSizePixel.Height() = 0; + } + pDockingParent->SetMinOutputSizePixel(aMinOutSizePixel); } - ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(aMinOutSizePixel); const Point aPos = aContentTree.GetPosPixel(); Point aLBPos = aDocListBox.GetPosPixel(); @@ -742,9 +750,8 @@ void SwNavigationPI::Resize() aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree.GetPosPixel().Y()); aGlobalTree.SetSizePixel(aNewSize); aDocListBox.SetPosSizePixel( aLBPos.X(), aLBPos.Y(), - aDocLBSz.Width(), aDocLBSz.Height(), - WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH); - + aDocLBSz.Width(), aDocLBSz.Height(), + WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH); } } @@ -851,21 +858,29 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, nWishWidth = aContentToolboxSize.Width(); nWishWidth += 2 * aContentToolBox.GetPosPixel().X(); - FloatingWindow* pFloat = ((DockingWindow*)pParent)->GetFloatingWindow(); - Size aMinSize(pFloat ? nWishWidth : 0, pFloat ? nZoomOutInit : 0); - ((SfxDockingWindow*)pParent)->SetMinOutputSizePixel(aMinSize); - SetOutputSizePixel( Size( nWishWidth, nZoomOutInit)); - Size aTmpParentSize(((SfxDockingWindow*)pParent)->GetSizePixel()); - if( - ( - aTmpParentSize.Width() < aMinSize.Width() || - aTmpParentSize.Height() < aMinSize.Height() - ) - && - ((SfxDockingWindow*)pParent)->GetFloatingWindow() && - !((SfxDockingWindow*)pParent)->GetFloatingWindow()->IsRollUp() - ) - ((SfxDockingWindow*)pParent)->SetOutputSizePixel(aMinSize); + DockingWindow* pDockingParent = dynamic_cast<DockingWindow*>(pParent); + if (pDockingParent != NULL) + { + FloatingWindow* pFloat = pDockingParent->GetFloatingWindow(); + Size aMinSize(pFloat ? nWishWidth : 0, pFloat ? nZoomOutInit : 0); + pDockingParent->SetMinOutputSizePixel(aMinSize); + SetOutputSizePixel( Size( nWishWidth, nZoomOutInit)); + + SfxDockingWindow* pSfxDockingParent = dynamic_cast<SfxDockingWindow*>(pParent); + if (pSfxDockingParent != NULL) + { + Size aTmpParentSize(pSfxDockingParent->GetSizePixel()); + if (aTmpParentSize.Width() < aMinSize.Width() + || aTmpParentSize.Height() < aMinSize.Height()) + { + if (pSfxDockingParent->GetFloatingWindow() + && ! pSfxDockingParent->GetFloatingWindow()->IsRollUp()) + { + pSfxDockingParent->SetOutputSizePixel(aMinSize); + } + } + } + } aContentTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); aContentTree.SetStyle( aContentTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT| @@ -937,6 +952,15 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, aContentTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT)); aGlobalTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL)); aDocListBox.SetAccessibleName(aStatusArr[3]); + + if (pContextWin == NULL) + { + // When the context window is missing then the navigator is + // displayed in the sidebar. While the navigator could change + // its size, the sidebar can not, and the navigator would just + // waste space. Therefore hide this button. + aContentToolBox.RemoveItem(aContentToolBox.GetItemPos(FN_SHOW_CONTENT_BOX)); + } } /*------------------------------------------------------------------------ diff --git a/sw/source/ui/wrtsh/wrtsh3.cxx b/sw/source/ui/wrtsh/wrtsh3.cxx index 1a3d54265d13..e8920b751eb5 100644 --- a/sw/source/ui/wrtsh/wrtsh3.cxx +++ b/sw/source/ui/wrtsh/wrtsh3.cxx @@ -128,7 +128,12 @@ void SwWrtShell::DrawSelChanged( ) static sal_uInt16 __READONLY_DATA aInval[] = { SID_ATTR_FILL_STYLE, SID_ATTR_FILL_COLOR, SID_ATTR_LINE_STYLE, - SID_ATTR_LINE_WIDTH, SID_ATTR_LINE_COLOR, 0 + SID_ATTR_LINE_WIDTH, SID_ATTR_LINE_COLOR, + /*AF: these may be needed for the sidebar. + SID_SVX_AREA_TRANSPARENCY, SID_SVX_AREA_TRANSP_GRADIENT, + SID_SVX_AREA_TRANS_TYPE, + */ + 0 }; GetView().GetViewFrame()->GetBindings().Invalidate(aInval); |