cui/source/dialogs/hldoctp.cxx | 2 cui/source/dialogs/hlinettp.cxx | 2 cui/source/dialogs/hlmarkwn.cxx | 155 ++++++++++++++++++++++++++------ cui/source/dialogs/hltpbase.cxx | 2 cui/source/inc/hldoctp.hxx | 2 cui/source/inc/hlinettp.hxx | 2 cui/source/inc/hlmarkwn.hxx | 9 + cui/source/inc/hltpbase.hxx | 2 sw/UIConfig_swriter.mk | 1 sw/inc/helpid.h | 1 sw/source/ui/dialog/regionsw.hrc | 8 - sw/source/ui/dialog/regionsw.src | 69 -------------- sw/source/ui/dialog/uiregionsw.cxx | 55 +++++------ sw/source/ui/inc/regionsw.hxx | 12 -- sw/uiconfig/swriter/ui/indentpage.ui | 167 +++++++++++++++++++++++++++++++++++ 15 files changed, 334 insertions(+), 155 deletions(-)
New commits: commit d49e3805c58b2c08c5cb0483ed620ab6ef86fedd Author: Caolán McNamara <caol...@redhat.com> Date: Wed Jul 31 16:11:55 2013 +0100 InsertTarget UniString->OUString Change-Id: If335c313c9c2a13cc748adc9f21492d213f8a4fa diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx index a7db3c3..001c2b2 100644 --- a/cui/source/dialogs/hldoctp.cxx +++ b/cui/source/dialogs/hldoctp.cxx @@ -341,7 +341,7 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, LostFocusPathHdl_Impl) |* |************************************************************************/ -void SvxHyperlinkDocTp::SetMarkStr ( String& aStrMark ) +void SvxHyperlinkDocTp::SetMarkStr ( const String& aStrMark ) { maEdTarget.SetText ( aStrMark ); diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx index e0866fc..9e7392e 100644 --- a/cui/source/dialogs/hlinettp.cxx +++ b/cui/source/dialogs/hlinettp.cxx @@ -465,7 +465,7 @@ void SvxHyperlinkInternetTp::RefreshMarkWindow() |* |************************************************************************/ -void SvxHyperlinkInternetTp::SetMarkStr ( String& aStrMark ) +void SvxHyperlinkInternetTp::SetMarkStr ( const String& aStrMark ) { String aStrURL ( maCbbTarget.GetText() ); diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx index bd7a50e..8366fa6 100644 --- a/cui/source/dialogs/hlmarkwn.cxx +++ b/cui/source/dialogs/hlmarkwn.cxx @@ -53,13 +53,13 @@ using namespace ::rtl; struct TargetData { - OUString aUStrLinkname; - sal_Bool bIsTarget; + OUString aUStrLinkname; + bool bIsTarget; - TargetData ( OUString aUStrLName, sal_Bool bTarget ) - : bIsTarget ( bTarget ) + TargetData (OUString aUStrLName, bool bTarget) + : bIsTarget(bTarget) { - if ( bIsTarget ) + if (bIsTarget) aUStrLinkname = aUStrLName; } }; @@ -269,7 +269,7 @@ void SvxHlinkDlgMarkWnd::RestoreLastSelection() |* |************************************************************************/ -void SvxHlinkDlgMarkWnd::RefreshTree ( String aStrURL ) +void SvxHlinkDlgMarkWnd::RefreshTree (OUString aStrURL) { OUString aUStrURL; @@ -277,19 +277,19 @@ void SvxHlinkDlgMarkWnd::RefreshTree ( String aStrURL ) ClearTree(); - xub_StrLen nPos = aStrURL.Search ( sal_Unicode('#') ); + sal_Int32 nPos = aStrURL.indexOf('#'); - if( nPos != 0 ) - aUStrURL = OUString( aStrURL ); + if (nPos != 0) + aUStrURL = aStrURL; - if( !RefreshFromDoc ( aUStrURL ) ) + if (!RefreshFromDoc(aUStrURL)) maLbTree.Invalidate(); bool bSelectedEntry = false; - if ( nPos != STRING_NOTFOUND ) + if ( nPos != -1 ) { - String aStrMark = aStrURL.Copy ( nPos+1 ); + OUString aStrMark = aStrURL.copy(nPos+1); bSelectedEntry = SelectEntry(aStrMark); } @@ -307,7 +307,7 @@ void SvxHlinkDlgMarkWnd::RefreshTree ( String aStrURL ) |* |************************************************************************/ -sal_Bool SvxHlinkDlgMarkWnd::RefreshFromDoc( OUString aURL ) +sal_Bool SvxHlinkDlgMarkWnd::RefreshFromDoc(OUString aURL) { mnError = LERR_NOERROR; @@ -497,7 +497,7 @@ void SvxHlinkDlgMarkWnd::ClearTree() |* |************************************************************************/ -SvTreeListEntry* SvxHlinkDlgMarkWnd::FindEntry ( String aStrName ) +SvTreeListEntry* SvxHlinkDlgMarkWnd::FindEntry (OUString aStrName) { sal_Bool bFound=sal_False; SvTreeListEntry* pEntry = maLbTree.First(); @@ -505,7 +505,7 @@ SvTreeListEntry* SvxHlinkDlgMarkWnd::FindEntry ( String aStrName ) while ( pEntry && !bFound ) { TargetData* pUserData = ( TargetData * ) pEntry->GetUserData (); - if ( aStrName == String( pUserData->aUStrLinkname ) ) + if (aStrName == pUserData->aUStrLinkname) bFound = sal_True; else pEntry = maLbTree.Next( pEntry ); @@ -520,13 +520,13 @@ SvTreeListEntry* SvxHlinkDlgMarkWnd::FindEntry ( String aStrName ) |* |************************************************************************/ -bool SvxHlinkDlgMarkWnd::SelectEntry(String aStrMark) +bool SvxHlinkDlgMarkWnd::SelectEntry(OUString aStrMark) { - SvTreeListEntry* pEntry = FindEntry ( aStrMark ); + SvTreeListEntry* pEntry = FindEntry(aStrMark); if (!pEntry) return false; - maLbTree.Select ( pEntry ); - maLbTree.MakeVisible ( pEntry ); + maLbTree.Select(pEntry); + maLbTree.MakeVisible (pEntry); return true; } @@ -546,8 +546,7 @@ IMPL_LINK_NOARG(SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl) if ( pData->bIsTarget ) { - String aStrMark ( pData->aUStrLinkname ); - mpParent->SetMarkStr ( aStrMark ); + mpParent->SetMarkStr(pData->aUStrLinkname); } } diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx index 273d89e..791f7c9 100644 --- a/cui/source/dialogs/hltpbase.cxx +++ b/cui/source/dialogs/hltpbase.cxx @@ -308,7 +308,7 @@ sal_Bool SvxHyperlinkTabPageBase::AskApply () } // This method would be called from bookmark-window to set new mark-string -void SvxHyperlinkTabPageBase::SetMarkStr ( String& /*aStrMark*/ ) +void SvxHyperlinkTabPageBase::SetMarkStr ( const String& /*aStrMark*/ ) { // default-implemtation : do nothing } diff --git a/cui/source/inc/hldoctp.hxx b/cui/source/inc/hldoctp.hxx index c610aa7..786a422 100644 --- a/cui/source/inc/hldoctp.hxx +++ b/cui/source/inc/hldoctp.hxx @@ -76,7 +76,7 @@ public: static IconChoicePage* Create( Window* pWindow, const SfxItemSet& rItemSet ); - virtual void SetMarkStr ( String& aStrMark ); + virtual void SetMarkStr ( const String& aStrMark ); virtual void SetInitFocus(); }; diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx index 8fef54d..c79ead8 100644 --- a/cui/source/inc/hlinettp.hxx +++ b/cui/source/inc/hlinettp.hxx @@ -86,7 +86,7 @@ public: static IconChoicePage* Create( Window* pWindow, const SfxItemSet& rItemSet ); - virtual void SetMarkStr ( String& aStrMark ); + virtual void SetMarkStr ( const String& aStrMark ); virtual void SetOnlineMode( sal_Bool bEnable ); virtual void SetInitFocus(); diff --git a/cui/source/inc/hlmarkwn.hxx b/cui/source/inc/hlmarkwn.hxx index 18629a3..edb1013 100644 --- a/cui/source/inc/hlmarkwn.hxx +++ b/cui/source/inc/hlmarkwn.hxx @@ -66,7 +66,7 @@ private: SvxHyperlinkTabPageBase* mpParent; - String maStrLastURL; + OUString maStrLastURL; sal_uInt16 mnError; @@ -74,7 +74,7 @@ protected: sal_Bool RefreshFromDoc( OUString aURL ); void RestoreLastSelection(); - SvTreeListEntry* FindEntry ( String aStrName ); + SvTreeListEntry* FindEntry(OUString aStrName); void ClearTree(); int FillTree( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xLinks, SvTreeListEntry* pParentEntry =NULL ); @@ -88,8 +88,8 @@ public: ~SvxHlinkDlgMarkWnd(); sal_Bool MoveTo ( Point aNewPos ); - void RefreshTree ( String aStrURL ); - bool SelectEntry(String aStrMark); + void RefreshTree(OUString aStrURL); + bool SelectEntry(OUString aStrMark); sal_Bool ConnectToDialog( sal_Bool bDoit = sal_True ); diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx index f4fcf52..8e80f17 100644 --- a/cui/source/inc/hltpbase.hxx +++ b/cui/source/inc/hltpbase.hxx @@ -140,7 +140,7 @@ public: virtual void DoApply (); virtual void SetOnlineMode( sal_Bool bEnable ); virtual void SetInitFocus(); - virtual void SetMarkStr ( String& aStrMark ); + virtual void SetMarkStr ( const String& aStrMark ); virtual void Reset( const SfxItemSet& ); virtual sal_Bool FillItemSet( SfxItemSet& ); virtual void ActivatePage( const SfxItemSet& rItemSet ); commit d7d7b51c23a921803929f716a6554d869b1150a3 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Jul 31 14:51:48 2013 +0100 restore last selection of target-in-document dialog Change-Id: Ib6eb3d9089b71888de76e338015519845d9f6b9d diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx index c07b375..bd7a50e 100644 --- a/cui/source/dialogs/hlmarkwn.cxx +++ b/cui/source/dialogs/hlmarkwn.cxx @@ -17,14 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vcl/wrkwin.hxx> #include <dialmgr.hxx> #include <sfx2/docfile.hxx> +#include <unotools/viewoptions.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <vcl/wrkwin.hxx> // UNO-Stuff #include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> #include <com/sun/star/awt/XBitmap.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> @@ -138,7 +140,6 @@ SvxHlinkDlgMarkWnd::SvxHlinkDlgMarkWnd( SvxHyperlinkTabPageBase *pParent ) WB_HSCROLL | WB_HASBUTTONSATROOT ); maLbTree.SetAccessibleName(String(CUI_RES(STR_MARK_TREE))); - } SvxHlinkDlgMarkWnd::~SvxHlinkDlgMarkWnd() @@ -200,6 +201,68 @@ sal_Bool SvxHlinkDlgMarkWnd::ConnectToDialog( sal_Bool bDoit ) return bOldStatus; } +namespace +{ + void SelectPath(SvTreeListEntry *pEntry, SvxHlmarkTreeLBox &rLbTree, + std::deque<OUString> &rLastSelectedPath) + { + OUString sTitle(rLastSelectedPath.front()); + rLastSelectedPath.pop_front(); + if (sTitle.isEmpty()) + return; + while (pEntry) + { + if (sTitle == rLbTree.GetEntryText(pEntry)) + { + rLbTree.Select(pEntry); + rLbTree.MakeVisible(pEntry); + if (!rLastSelectedPath.empty()) + { + rLbTree.Expand(pEntry); + SelectPath(rLbTree.FirstChild(pEntry), rLbTree, rLastSelectedPath); + } + break; + } + pEntry = rLbTree.NextSibling(pEntry); + } + } +} + +#define TG_SETTING_MANAGER "TargetInDocument" +#define TG_SETTING_LASTMARK "LastSelectedMark" +#define TG_SETTING_LASTPATH "LastSelectedPath" + +void SvxHlinkDlgMarkWnd::RestoreLastSelection() +{ + bool bSelectedEntry = false; + + OUString sLastSelectedMark; + std::deque<OUString> aLastSelectedPath; + SvtViewOptions aViewSettings( E_DIALOG, TG_SETTING_MANAGER ); + if (aViewSettings.Exists()) + { + //Maybe we might want to have some sort of mru list and keep a mapping + //per document, rather than the current reuse of "the last thing + //selected, regardless of the document" + aViewSettings.GetUserItem(TG_SETTING_LASTMARK) >>= sLastSelectedMark; + uno::Sequence<OUString> aTmp; + aViewSettings.GetUserItem(TG_SETTING_LASTPATH) >>= aTmp; + aLastSelectedPath = comphelper::sequenceToContainer< std::deque<OUString> >(aTmp); + } + //fallback to previous entry selected the last + //time we executed this dialog. First see if + //the exact mark exists and re-use that + if (!sLastSelectedMark.isEmpty()) + bSelectedEntry = SelectEntry(sLastSelectedMark); + //Otherwise just select the closest path available + //now to what was available at dialog close time + if (!bSelectedEntry && !aLastSelectedPath.empty()) + { + std::deque<OUString> aTmpSelectedPath(aLastSelectedPath); + SelectPath(maLbTree.First(), maLbTree, aTmpSelectedPath); + } +} + /************************************************************************* |* |* Interface to refresh tree @@ -222,12 +285,17 @@ void SvxHlinkDlgMarkWnd::RefreshTree ( String aStrURL ) if( !RefreshFromDoc ( aUStrURL ) ) maLbTree.Invalidate(); + bool bSelectedEntry = false; + if ( nPos != STRING_NOTFOUND ) { String aStrMark = aStrURL.Copy ( nPos+1 ); - SelectEntry ( aStrMark ); + bSelectedEntry = SelectEntry(aStrMark); } + if (!bSelectedEntry) + RestoreLastSelection(); + LeaveWait(); maStrLastURL = aStrURL; @@ -425,7 +493,7 @@ void SvxHlinkDlgMarkWnd::ClearTree() /************************************************************************* |* -|* Find Entry for Strng +|* Find Entry for String |* |************************************************************************/ @@ -452,14 +520,14 @@ SvTreeListEntry* SvxHlinkDlgMarkWnd::FindEntry ( String aStrName ) |* |************************************************************************/ -void SvxHlinkDlgMarkWnd::SelectEntry ( String aStrMark ) +bool SvxHlinkDlgMarkWnd::SelectEntry(String aStrMark) { SvTreeListEntry* pEntry = FindEntry ( aStrMark ); - if ( pEntry ) - { - maLbTree.Select ( pEntry ); - maLbTree.MakeVisible ( pEntry ); - } + if (!pEntry) + return false; + maLbTree.Select ( pEntry ); + maLbTree.MakeVisible ( pEntry ); + return true; } /************************************************************************* @@ -494,10 +562,40 @@ IMPL_LINK_NOARG(SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl) IMPL_LINK_NOARG(SvxHlinkDlgMarkWnd, ClickCloseHdl_Impl) { + SvTreeListEntry* pEntry = maLbTree.GetCurEntry(); + if ( pEntry ) + { + TargetData* pUserData = (TargetData *) pEntry->GetUserData(); + OUString sLastSelectedMark = pUserData->aUStrLinkname; + + std::deque<OUString> aLastSelectedPath; + if (pEntry) + { + //If the bottommost entry is expanded but nothing + //underneath it is selected leave a dummy entry + if (maLbTree.IsExpanded(pEntry)) + aLastSelectedPath.push_front(OUString()); + while (pEntry) + { + aLastSelectedPath.push_front(maLbTree.GetEntryText(pEntry)); + pEntry = maLbTree.GetParent(pEntry); + } + } + + uno::Sequence< beans::NamedValue > aSettings(2); + aSettings[0].Name = TG_SETTING_LASTMARK; + aSettings[0].Value <<= sLastSelectedMark; + aSettings[1].Name = TG_SETTING_LASTPATH; + aSettings[1].Value <<= comphelper::containerToSequence<OUString>(aLastSelectedPath); + + // write + SvtViewOptions aViewSettings( E_DIALOG, TG_SETTING_MANAGER ); + aViewSettings.SetUserData( aSettings ); + } + Close(); return( 0L ); } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/hlmarkwn.hxx b/cui/source/inc/hlmarkwn.hxx index ec170d3..18629a3 100644 --- a/cui/source/inc/hlmarkwn.hxx +++ b/cui/source/inc/hlmarkwn.hxx @@ -72,6 +72,7 @@ private: protected: sal_Bool RefreshFromDoc( OUString aURL ); + void RestoreLastSelection(); SvTreeListEntry* FindEntry ( String aStrName ); void ClearTree(); @@ -88,7 +89,7 @@ public: sal_Bool MoveTo ( Point aNewPos ); void RefreshTree ( String aStrURL ); - void SelectEntry ( String aStrMark ); + bool SelectEntry(String aStrMark); sal_Bool ConnectToDialog( sal_Bool bDoit = sal_True ); commit e78f75bc2da9d97be80e2bf240fa9ef38497ae4e Author: Caolán McNamara <caol...@redhat.com> Date: Wed Jul 31 00:06:26 2013 +0100 convert section indent tabpage to .ui Change-Id: I09b5f206d5e607b87528aa92f7f25be5df1a99c8 diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index c56a343..0e3f9ee 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -91,6 +91,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/frmurlpage \ sw/uiconfig/swriter/ui/indexentry \ sw/uiconfig/swriter/ui/inputfielddialog \ + sw/uiconfig/swriter/ui/indentpage \ sw/uiconfig/swriter/ui/insertbookmark \ sw/uiconfig/swriter/ui/insertbreak \ sw/uiconfig/swriter/ui/insertcaption \ diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index cb80c92..c5c6f81 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -433,7 +433,6 @@ #define HID_PRINT_AS_MERGE "SW_HID_PRINT_AS_MERGE" #define HID_MERGE_SOURCE_UNAVAILABLE "SW_HID_MERGE_SOURCE_UNAVAILABLE" #define HID_MODULE_TOOLBOX "SW_HID_MODULE_TOOLBOX" -#define HID_SECTION_INDENTS_PAGE "SW_HID_SECTION_INDENTS_PAGE" #define HID_MM_DOCSELECTPAGE "SW_HID_MM_DOCSELECTPAGE" #define HID_MM_OUTPUTTYPEPAGE "SW_HID_MM_OUTPUTTYPEPAGE" diff --git a/sw/source/ui/dialog/regionsw.hrc b/sw/source/ui/dialog/regionsw.hrc index 4f131cb..620382a 100644 --- a/sw/source/ui/dialog/regionsw.hrc +++ b/sw/source/ui/dialog/regionsw.hrc @@ -90,14 +90,6 @@ #define BMP_PROT_HIDE 3 #define BMP_PROT_NO_HIDE 4 -//SwSectionIndentTabPage -#define FL_INDENT 1 -#define FT_BEFORE 2 -#define MF_BEFORE 3 -#define FT_AFTER 4 -#define MF_AFTER 5 -#define WIN_PREVIEW 6 - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dialog/regionsw.src b/sw/source/ui/dialog/regionsw.src index 111a3da..ec820ad 100644 --- a/sw/source/ui/dialog/regionsw.src +++ b/sw/source/ui/dialog/regionsw.src @@ -585,73 +585,4 @@ TabPage TP_SECTION_FTNENDNOTES }; }; -TabPage TP_SECTION_INDENTS -{ - HelpID = HID_SECTION_INDENTS_PAGE; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ; - Hide = TRUE ; - FixedLine FL_INDENT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 173 , 8 ) ; - Text [ en-US ] = "Indent" ; - }; - FixedText FT_BEFORE - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "~Before section" ; - }; - MetricField MF_BEFORE - { - HelpID = "sw:MetricField:TP_SECTION_INDENTS:MF_BEFORE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 135 , 14 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 9999 ; - Minimum = -9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - Last = 9999 ; - SpinSize = 10 ; - }; - FixedText FT_AFTER - { - Pos = MAP_APPFONT ( 12 , 32 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "~After section" ; - }; - MetricField MF_AFTER - { - HelpID = "sw:MetricField:TP_SECTION_INDENTS:MF_AFTER"; - Border = TRUE ; - Pos = MAP_APPFONT ( 135 , 30 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 9999 ; - Minimum = -9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - Last = 9999 ; - SpinSize = 10 ; - }; - Window WIN_PREVIEW - { - Border = TRUE ; - Pos = MAP_APPFONT ( 185 , 7 ) ; - Size = MAP_APPFONT ( 68 , 112 ) ; - }; -}; - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index af33f8c..734f936 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -2158,20 +2158,15 @@ void SwSectionPropertyTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ((SwSectionIndentTabPage&)rPage).SetWrtShell(rWrtSh); } -SwSectionIndentTabPage::SwSectionIndentTabPage( Window *pParent, const SfxItemSet &rAttrSet ) : - SfxTabPage(pParent, SW_RES(TP_SECTION_INDENTS), rAttrSet), - aIndentFL(this, SW_RES(FL_INDENT )), - aBeforeFT(this, SW_RES(FT_BEFORE )), - aBeforeMF(this, SW_RES(MF_BEFORE )), - aAfterFT(this, SW_RES(FT_AFTER )), - aAfterMF(this, SW_RES(MF_AFTER )), - aPreviewWin(this, SW_RES(WIN_PREVIEW )) +SwSectionIndentTabPage::SwSectionIndentTabPage(Window *pParent, const SfxItemSet &rAttrSet) + : SfxTabPage(pParent, "IndentPage", "modules/swriter/ui/indentpage.ui", rAttrSet) { - FreeResource(); + get(m_pBeforeMF, "before"); + get(m_pAfterMF, "after"); + get(m_pPreviewWin, "preview"); Link aLk = LINK(this, SwSectionIndentTabPage, IndentModifyHdl); - aBeforeMF.SetModifyHdl(aLk); - aAfterMF.SetModifyHdl(aLk); - aPreviewWin.SetAccessibleName(aIndentFL.GetText()); + m_pBeforeMF->SetModifyHdl(aLk); + m_pAfterMF->SetModifyHdl(aLk); } SwSectionIndentTabPage::~SwSectionIndentTabPage() @@ -2180,12 +2175,12 @@ SwSectionIndentTabPage::~SwSectionIndentTabPage() sal_Bool SwSectionIndentTabPage::FillItemSet( SfxItemSet& rSet) { - if(aBeforeMF.IsValueModified() || - aAfterMF.IsValueModified()) + if(m_pBeforeMF->IsValueModified() || + m_pAfterMF->IsValueModified()) { SvxLRSpaceItem aLRSpace( - static_cast< long >(aBeforeMF.Denormalize(aBeforeMF.GetValue(FUNIT_TWIP))) , - static_cast< long >(aAfterMF.Denormalize(aAfterMF.GetValue(FUNIT_TWIP))), 0, 0, RES_LR_SPACE); + static_cast< long >(m_pBeforeMF->Denormalize(m_pBeforeMF->GetValue(FUNIT_TWIP))) , + static_cast< long >(m_pAfterMF->Denormalize(m_pAfterMF->GetValue(FUNIT_TWIP))), 0, 0, RES_LR_SPACE); rSet.Put(aLRSpace); } return sal_True; @@ -2195,8 +2190,8 @@ void SwSectionIndentTabPage::Reset( const SfxItemSet& rSet) { //this page doesn't show up in HTML mode FieldUnit aMetric = ::GetDfltMetric(sal_False); - SetMetric(aBeforeMF, aMetric); - SetMetric(aAfterMF , aMetric); + SetMetric(*m_pBeforeMF, aMetric); + SetMetric(*m_pAfterMF , aMetric); SfxItemState eItemState = rSet.GetItemState( RES_LR_SPACE ); if ( eItemState >= SFX_ITEM_AVAILABLE ) @@ -2204,16 +2199,16 @@ void SwSectionIndentTabPage::Reset( const SfxItemSet& rSet) const SvxLRSpaceItem& rSpace = (const SvxLRSpaceItem&)rSet.Get( RES_LR_SPACE ); - aBeforeMF.SetValue( aBeforeMF.Normalize(rSpace.GetLeft()), FUNIT_TWIP ); - aAfterMF.SetValue( aAfterMF.Normalize(rSpace.GetRight()), FUNIT_TWIP ); + m_pBeforeMF->SetValue( m_pBeforeMF->Normalize(rSpace.GetLeft()), FUNIT_TWIP ); + m_pAfterMF->SetValue( m_pAfterMF->Normalize(rSpace.GetRight()), FUNIT_TWIP ); } else { - aBeforeMF.SetEmptyFieldValue(); - aAfterMF.SetEmptyFieldValue(); + m_pBeforeMF->SetEmptyFieldValue(); + m_pAfterMF->SetEmptyFieldValue(); } - aBeforeMF.SaveValue(); - aAfterMF.SaveValue(); + m_pBeforeMF->SaveValue(); + m_pAfterMF->SaveValue(); IndentModifyHdl(0); } @@ -2225,18 +2220,18 @@ SfxTabPage* SwSectionIndentTabPage::Create( Window* pParent, const SfxItemSet& void SwSectionIndentTabPage::SetWrtShell(SwWrtShell& rSh) { //set sensible values at the preview - aPreviewWin.SetAdjust(SVX_ADJUST_BLOCK); - aPreviewWin.SetLastLine(SVX_ADJUST_BLOCK); + m_pPreviewWin->SetAdjust(SVX_ADJUST_BLOCK); + m_pPreviewWin->SetLastLine(SVX_ADJUST_BLOCK); const SwRect& rPageRect = rSh.GetAnyCurRect( RECT_PAGE, 0 ); Size aPageSize(rPageRect.Width(), rPageRect.Height()); - aPreviewWin.SetSize(aPageSize); + m_pPreviewWin->SetSize(aPageSize); } IMPL_LINK_NOARG(SwSectionIndentTabPage, IndentModifyHdl) { - aPreviewWin.SetLeftMargin( static_cast< long >(aBeforeMF.Denormalize(aBeforeMF.GetValue(FUNIT_TWIP))) ); - aPreviewWin.SetRightMargin( static_cast< long >(aAfterMF.Denormalize(aAfterMF.GetValue(FUNIT_TWIP))) ); - aPreviewWin.Draw(sal_True); + m_pPreviewWin->SetLeftMargin( static_cast< long >(m_pBeforeMF->Denormalize(m_pBeforeMF->GetValue(FUNIT_TWIP))) ); + m_pPreviewWin->SetRightMargin( static_cast< long >(m_pAfterMF->Denormalize(m_pAfterMF->GetValue(FUNIT_TWIP))) ); + m_pPreviewWin->Draw(sal_True); return 0; } diff --git a/sw/source/ui/inc/regionsw.hxx b/sw/source/ui/inc/regionsw.hxx index 14265da..75bebb6 100644 --- a/sw/source/ui/inc/regionsw.hxx +++ b/sw/source/ui/inc/regionsw.hxx @@ -252,20 +252,16 @@ public: class SwSectionIndentTabPage : public SfxTabPage { - FixedLine aIndentFL; - FixedText aBeforeFT; - MetricField aBeforeMF; - FixedText aAfterFT; - MetricField aAfterMF; - - SvxParaPrevWindow aPreviewWin; + MetricField* m_pBeforeMF; + MetricField* m_pAfterMF; + SvxParaPrevWindow* m_pPreviewWin; DECL_LINK(IndentModifyHdl, void *); public: SwSectionIndentTabPage( Window *pParent, const SfxItemSet &rAttrSet ); virtual ~SwSectionIndentTabPage(); - virtual sal_Bool FillItemSet( SfxItemSet& ); + virtual sal_Bool FillItemSet( SfxItemSet& ); virtual void Reset( const SfxItemSet& ); static SfxTabPage* Create( Window* pParent, diff --git a/sw/uiconfig/swriter/ui/indentpage.ui b/sw/uiconfig/swriter/ui/indentpage.ui new file mode 100644 index 0000000..df4079e --- /dev/null +++ b/sw/uiconfig/swriter/ui/indentpage.ui @@ -0,0 +1,167 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <!-- interface-requires LibreOffice 1.0 --> + <object class="GtkAdjustment" id="adjustment1"> + <property name="lower">-99.989999999999995</property> + <property name="upper">99.989999999999995</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> + <object class="GtkGrid" id="IndentPage"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="border_width">6</property> + <property name="row_spacing">12</property> + <child> + <object class="GtkGrid" id="grid3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">3</property> + <property name="column_spacing">30</property> + <child> + <object class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="hexpand">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Before section</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_After section</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="before:0.00cm"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">â</property> + <property name="adjustment">adjustment1</property> + <property name="digits">2</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="after:0.00cm"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">â</property> + <property name="invisible_char_set">True</property> + <property name="adjustment">adjustment1</property> + <property name="digits">2</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Indent</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="top_padding">24</property> + <child> + <object class="svxlo-SvxParaPrevWindow" id="preview"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">center</property> + <property name="valign">start</property> + <child internal-child="accessible"> + <object class="AtkObject" id="preview-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Example</property> + </object> + </child> + </object> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> +</interface>
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits