Kaydet (Commit) 58ba8835 authored tarafından Caolán McNamara's avatar Caolán McNamara

adapt code to comment .ui conversion

Change-Id: I93f98f50443ab3b2fb0ce9f3126b03c8a3281ad2
üst 67f6b20e
......@@ -67,7 +67,6 @@ $(eval $(call gb_SrsTarget_add_files,cui/res,\
cui/source/dialogs/iconcdlg.src \
cui/source/dialogs/multipat.src \
cui/source/dialogs/passwdomdlg.src \
cui/source/dialogs/postdlg.src \
cui/source/dialogs/scriptdlg.src \
cui/source/dialogs/sdrcelldlg.src \
cui/source/dialogs/showcols.src \
......
......@@ -15,6 +15,7 @@ $(eval $(call gb_UI_add_uifiles,cui,\
cui/uiconfig/ui/borderpage \
cui/uiconfig/ui/charnamepage \
cui/uiconfig/ui/colorpage \
cui/uiconfig/ui/comment \
cui/uiconfig/ui/gradientpage \
cui/uiconfig/ui/colorconfigwin \
cui/uiconfig/ui/effectspage \
......
......@@ -28,77 +28,56 @@
#include <unotools/localedatawrapper.hxx>
#include <comphelper/processfactory.hxx>
#include <svx/svxids.hrc> // SID_ATTR_...
#include <svx/dialogs.hrc> // RID_SVXDLG_POSTIT
#define _SVX_POSTDLG_CXX
#include <cuires.hrc>
#include "postdlg.hrc"
#include <svx/postattr.hxx>
#include "postdlg.hxx"
#include <dialmgr.hxx>
#include "helpid.hrc"
// static ----------------------------------------------------------------
static sal_uInt16 pRanges[] =
{
SID_ATTR_POSTIT_AUTHOR,
SID_ATTR_POSTIT_TEXT,
0
};
// class SvxPostItDialog -------------------------------------------------
SvxPostItDialog::SvxPostItDialog( Window* pParent,
const SfxItemSet& rCoreSet,
sal_Bool bPrevNext,
sal_Bool bRedline ) :
SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_POSTIT ) ),
aPostItFL ( this, CUI_RES( FL_POSTIT ) ),
aLastEditLabelFT( this, CUI_RES( FT_LASTEDITLABEL ) ),
aLastEditFT ( this, CUI_RES( FT_LASTEDIT ) ),
aEditFT ( this, CUI_RES( FT_EDIT ) ),
aEditED ( this, CUI_RES( ED_EDIT ) ),
aAuthorFT ( this, CUI_RES( FT_AUTHOR) ),
aAuthorBtn ( this, CUI_RES( BTN_AUTHOR ) ),
aOKBtn ( this, CUI_RES( BTN_POST_OK ) ),
aCancelBtn ( this, CUI_RES( BTN_POST_CANCEL ) ),
aHelpBtn ( this, CUI_RES( BTN_POST_HELP ) ),
aPrevBtn ( this, CUI_RES( BTN_PREV ) ),
aNextBtn ( this, CUI_RES( BTN_NEXT ) ),
rSet ( rCoreSet ),
pOutSet ( 0 )
SvxPostItDialog::SvxPostItDialog(Window* pParent, const SfxItemSet& rCoreSet,
bool bPrevNext, bool bRedline)
: SfxModalDialog(pParent, "CommentDialog", "cui/ui/comment.ui")
, rSet(rCoreSet)
, pOutSet(0)
{
get(m_pLastEditFT, "lastedit");
get(m_pInsertAuthor, "insertauthor");
get(m_pAuthorBtn, "author");
get(m_pOKBtn, "ok");
get(m_pPrevBtn, "previous");
get(m_pNextBtn, "next");
get(m_pEditED, "edit");
if (bRedline) // HelpIDs for redlining
{
SetHelpId(HID_REDLINING_DLG);
aEditED.SetHelpId(HID_REDLINING_EDIT);
aPrevBtn.SetHelpId(HID_REDLINING_PREV);
aNextBtn.SetHelpId(HID_REDLINING_NEXT);
m_pEditED->SetHelpId(HID_REDLINING_EDIT);
m_pPrevBtn->SetHelpId(HID_REDLINING_PREV);
m_pNextBtn->SetHelpId(HID_REDLINING_NEXT);
}
aPrevBtn.SetClickHdl( LINK( this, SvxPostItDialog, PrevHdl ) );
aNextBtn.SetClickHdl( LINK( this, SvxPostItDialog, NextHdl ) );
aAuthorBtn.SetClickHdl( LINK( this, SvxPostItDialog, Stamp ) );
aOKBtn.SetClickHdl( LINK( this, SvxPostItDialog, OKHdl ) );
m_pPrevBtn->SetClickHdl( LINK( this, SvxPostItDialog, PrevHdl ) );
m_pNextBtn->SetClickHdl( LINK( this, SvxPostItDialog, NextHdl ) );
m_pAuthorBtn->SetClickHdl( LINK( this, SvxPostItDialog, Stamp ) );
m_pOKBtn->SetClickHdl( LINK( this, SvxPostItDialog, OKHdl ) );
Font aFont( aEditED.GetFont() );
Font aFont( m_pEditED->GetFont() );
aFont.SetWeight( WEIGHT_LIGHT );
aEditED.SetFont( aFont );
m_pEditED->SetFont( aFont );
sal_Bool bNew = sal_True;
sal_uInt16 nWhich = 0;
sal_uInt16 nWhich = 0;
if ( !bPrevNext )
{
aPrevBtn.Hide();
aNextBtn.Hide();
m_pPrevBtn->Hide();
m_pNextBtn->Hide();
}
nWhich = rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_AUTHOR );
......@@ -139,19 +118,16 @@ SvxPostItDialog::SvxPostItDialog( Window* pParent,
}
ShowLastAuthor(aAuthorStr, aDateStr);
aEditED.SetText(convertLineEnd(aTextStr, GetSystemLineEnd()));
if ( !bNew )
SetText( CUI_RESSTR( STR_NOTIZ_EDIT ) );
else
// create newly
SetText( CUI_RESSTR( STR_NOTIZ_INSERT ) );
//lock to initial .ui placeholder size before replacing contents
Size aSize(m_pEditED->get_preferred_size());
m_pEditED->set_width_request(aSize.Width());
m_pEditED->set_height_request(aSize.Height());
FreeResource();
m_pEditED->SetText(convertLineEnd(aTextStr, GetSystemLineEnd()));
aEditED.SetAccessibleRelationLabeledBy(&aEditFT);
aEditED.SetAccessibleRelationMemberOf(&aPostItFL);
aAuthorBtn.SetAccessibleRelationMemberOf(&aPostItFL);
if (!bNew)
SetText( get<FixedText>("alttitle")->GetText() );
}
// -----------------------------------------------------------------------
......@@ -169,13 +145,19 @@ void SvxPostItDialog::ShowLastAuthor(const String& rAuthor, const String& rDate)
String sTxt( rAuthor );
sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) );
sTxt += rDate;
aLastEditFT.SetText( sTxt );
m_pLastEditFT->SetText( sTxt );
}
// -----------------------------------------------------------------------
sal_uInt16* SvxPostItDialog::GetRanges()
{
static sal_uInt16 pRanges[] =
{
SID_ATTR_POSTIT_AUTHOR,
SID_ATTR_POSTIT_TEXT,
0
};
return pRanges;
}
......@@ -183,8 +165,8 @@ sal_uInt16* SvxPostItDialog::GetRanges()
void SvxPostItDialog::EnableTravel(sal_Bool bNext, sal_Bool bPrev)
{
aPrevBtn.Enable(bPrev);
aNextBtn.Enable(bNext);
m_pPrevBtn->Enable(bPrev);
m_pNextBtn->Enable(bNext);
}
// -----------------------------------------------------------------------
......@@ -213,7 +195,7 @@ IMPL_LINK_NOARG(SvxPostItDialog, Stamp)
Time aTime( Time::SYSTEM );
String aTmp( SvtUserOptions().GetID() );
const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
String aStr( aEditED.GetText() );
String aStr( m_pEditED->GetText() );
aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\n---- " ) );
if ( aTmp.Len() > 0 )
......@@ -228,10 +210,10 @@ IMPL_LINK_NOARG(SvxPostItDialog, Stamp)
aStr = convertLineEnd(aStr, GetSystemLineEnd());
aEditED.SetText(aStr);
m_pEditED->SetText(aStr);
xub_StrLen nLen = aStr.Len();
aEditED.GrabFocus();
aEditED.SetSelection( Selection( nLen, nLen ) );
m_pEditED->GrabFocus();
m_pEditED->SetSelection( Selection( nLen, nLen ) );
return 0;
}
......@@ -245,7 +227,7 @@ IMPL_LINK_NOARG(SvxPostItDialog, OKHdl)
rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_AUTHOR ) ) );
pOutSet->Put( SvxPostItDateItem( rLocaleWrapper.getDate( Date( Date::SYSTEM ) ),
rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_DATE ) ) );
pOutSet->Put( SvxPostItTextItem( aEditED.GetText(),
pOutSet->Put( SvxPostItTextItem( m_pEditED->GetText(),
rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_TEXT ) ) );
EndDialog( RET_OK );
return 0;
......
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#ifndef _SVX_POSTDLG_HRC
#define _SVX_POSTDLG_HRC
// defines ------------------------------------------------------------------
#define FT_LASTEDITLABEL 10
#define FT_LASTEDIT 11
#define FT_EDIT 12
#define ED_EDIT 13
#define FL_POSTIT 14
#define BTN_PREV 15
#define BTN_NEXT 16
#define BTN_AUTHOR 17
#define FT_AUTHOR 18
#define STR_NOTIZ_EDIT 20
#define STR_NOTIZ_INSERT 21
#define BTN_POST_OK 30
#define BTN_POST_CANCEL 31
#define BTN_POST_HELP 32
#endif
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#include <cuires.hrc>
#include "postdlg.hrc"
#include "helpid.hrc"
#include <svx/dialogs.hrc> // for RID_SVXDLG_POSTIT
// RID_SVXDLG_POSTIT -----------------------------------------------------
ModalDialog RID_SVXDLG_POSTIT
{
HelpId = HID_POSTIT_DIALOG ;
OutputSize = TRUE ;
SvLook = TRUE ;
Size = MAP_APPFONT ( 198 , 134 ) ;
Text [ en-US ] = "Comment" ;
Moveable = TRUE ;
FixedText FT_LASTEDITLABEL
{
Pos = MAP_APPFONT ( 12 , 14 ) ;
Size = MAP_APPFONT ( 34 , 8 ) ;
Text [ en-US ] = "Author" ;
Left = TRUE ;
};
FixedText FT_LASTEDIT
{
Pos = MAP_APPFONT ( 48 , 14 ) ;
Size = MAP_APPFONT ( 83 , 8 ) ;
Left = TRUE ;
};
FixedText FT_EDIT
{
Pos = MAP_APPFONT ( 12 , 27 ) ;
Size = MAP_APPFONT ( 100 , 8 ) ;
Text [ en-US ] = "~Text" ;
Left = TRUE ;
};
MultiLineEdit ED_EDIT
{
HelpID = "cui:MultiLineEdit:RID_SVXDLG_POSTIT:ED_EDIT";
Border = TRUE ;
Pos = MAP_APPFONT ( 12 , 38 ) ;
Size = MAP_APPFONT ( 123 , 72 ) ;
Left = TRUE ;
VScroll = TRUE ;
HScroll = TRUE ;
IgnoreTab = TRUE ;
};
FixedLine FL_POSTIT
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
Size = MAP_APPFONT ( 129 , 8 ) ;
Text [ en-US ] = "Contents" ;
};
OKButton BTN_POST_OK
{
Pos = MAP_APPFONT ( 141 , 6 ) ;
Size = MAP_APPFONT ( 50 , 15 ) ;
DefButton = TRUE ;
};
CancelButton BTN_POST_CANCEL
{
Pos = MAP_APPFONT ( 141 , 23 ) ;
Size = MAP_APPFONT ( 50 , 15 ) ;
};
HelpButton BTN_POST_HELP
{
Pos = MAP_APPFONT ( 141 , 40 ) ;
Size = MAP_APPFONT ( 50 , 15 ) ;
};
ImageButton BTN_PREV
{
HelpID = "cui:ImageButton:RID_SVXDLG_POSTIT:BTN_PREV";
Pos = MAP_APPFONT ( 141 , 60 ) ;
Size = MAP_APPFONT ( 24 , 14 ) ;
Symbol = IMAGEBUTTON_ARROW_LEFT ;
};
ImageButton BTN_NEXT
{
HelpID = "cui:ImageButton:RID_SVXDLG_POSTIT:BTN_NEXT";
Pos = MAP_APPFONT ( 167 , 60 ) ;
Size = MAP_APPFONT ( 24 , 14 ) ;
Symbol = IMAGEBUTTON_ARROW_RIGHT ;
};
FixedText FT_AUTHOR
{
Pos = MAP_APPFONT ( 12 , 116 ) ;
Size = MAP_APPFONT ( 60 , 8 ) ;
Text [ en-US ] = "~Insert";
};
PushButton BTN_AUTHOR
{
HelpID = "cui:PushButton:RID_SVXDLG_POSTIT:BTN_AUTHOR";
Pos = MAP_APPFONT ( 75 , 114 ) ;
Size = MAP_APPFONT ( 60 , 14 ) ;
Text [ en-US ] = "Author" ;
};
// lokale Strings
String STR_NOTIZ_EDIT
{
Text [ en-US ] = "Edit Comment" ;
};
String STR_NOTIZ_INSERT
{
Text [ en-US ] = "Insert Comment" ;
};
};
// ********************************************************************** EOF
......@@ -1793,18 +1793,11 @@ CreateSvxDistributePage AbstractDialogFactory_Impl::GetSvxDistributePageCreatorF
return SvxDistributePage::Create;
}
DialogGetRanges AbstractDialogFactory_Impl::GetDialogGetRangesFunc( sal_uInt16 nId )
DialogGetRanges AbstractDialogFactory_Impl::GetDialogGetRangesFunc()
{
switch ( nId )
{
case RID_SVXDLG_POSTIT:
return SvxPostItDialog::GetRanges; //add for SvxPostItDialog
default:
break;
}
return 0;
return SvxPostItDialog::GetRanges; //add for SvxPostItDialog
}
GetTabPageRanges AbstractDialogFactory_Impl::GetTabPageRangesFunc( sal_uInt16 nId )
{
switch ( nId )
......
......@@ -749,7 +749,7 @@ public:
virtual CreateSvxDistributePage GetSvxDistributePageCreatorFunc();
virtual GetTabPageRanges GetTabPageRangesFunc( sal_uInt16 nId );
virtual DialogGetRanges GetDialogGetRangesFunc( sal_uInt16 nId ); //add for SvxPostItDialog
virtual DialogGetRanges GetDialogGetRangesFunc(); //add for SvxPostItDialog
virtual VclAbstractDialog* CreateSvxScriptOrgDialog( Window* pParent, const String& rLanguage );
virtual AbstractScriptSelectorDialog*
......
......@@ -305,7 +305,6 @@
#define HID_GALLERY_TITLE_EDIT "CUI_HID_GALLERY_TITLE_EDIT"
#define HID_OFAPAGE_QUOTE_SW_CLB "CUI_HID_OFAPAGE_QUOTE_SW_CLB"
#define HID_OFAPAGE_QUOTE_CLB "CUI_HID_OFAPAGE_QUOTE_CLB"
#define HID_POSTIT_DIALOG "CUI_HID_POSTIT_DIALOG"
#define HID_DLG_PASSWORD_TO_OPEN_MODIFY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY"
#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN"
......
......@@ -19,9 +19,10 @@
#ifndef _SVX_POSTDLG_HXX
#define _SVX_POSTDLG_HXX
#include <vcl/group.hxx>
#include <vcl/button.hxx>
#include <vcl/edit.hxx>
#include <vcl/group.hxx>
#include <vcl/layout.hxx>
#include <svtools/stdctrl.hxx>
#include <sfx2/basedlgs.hxx>
#include <svtools/svmedit.hxx>
......@@ -44,8 +45,8 @@
class SvxPostItDialog : public SfxModalDialog
{
public:
SvxPostItDialog( Window* pParent, const SfxItemSet& rCoreSet,
sal_Bool bPrevNext = sal_False, sal_Bool bRedline = sal_False );
SvxPostItDialog(Window* pParent, const SfxItemSet& rCoreSet,
bool bPrevNext = false, bool bRedline = false);
~SvxPostItDialog();
static sal_uInt16* GetRanges();
......@@ -58,38 +59,47 @@ public:
void SetNextHdl( const Link& rLink )
{ aNextHdlLink = rLink; }
void EnableTravel(sal_Bool bNext, sal_Bool bPrev);
inline String GetNote() { return aEditED.GetText(); }
inline void SetNote(const String& rTxt) { aEditED.SetText(rTxt); }
void ShowLastAuthor(const String& rAuthor, const String& rDate);
inline void DontChangeAuthor() { aAuthorBtn.Enable(sal_False); }
inline void HideAuthor() { aAuthorFT.Hide(); aAuthorBtn.Hide(); }
inline void SetReadonlyPostIt(sal_Bool bDisable)
{
aOKBtn.Enable( !bDisable );
aEditED.SetReadOnly( bDisable );
aAuthorBtn.Enable( !bDisable );
}
inline sal_Bool IsOkEnabled() const { return aOKBtn.IsEnabled(); }
void EnableTravel(sal_Bool bNext, sal_Bool bPrev);
String GetNote()
{
return m_pEditED->GetText();
}
void SetNote(const OUString& rTxt)
{
m_pEditED->SetText(rTxt);
}
void ShowLastAuthor(const String& rAuthor, const String& rDate);
void DontChangeAuthor()
{
m_pAuthorBtn->Enable(false);
}
void HideAuthor()
{
m_pInsertAuthor->Hide();
}
void SetReadonlyPostIt(bool bDisable)
{
m_pOKBtn->Enable( !bDisable );
m_pEditED->SetReadOnly( bDisable );
m_pAuthorBtn->Enable( !bDisable );
}
bool IsOkEnabled() const
{
return m_pOKBtn->IsEnabled();
}
private:
FixedLine aPostItFL;
FixedText aLastEditLabelFT;
FixedInfo aLastEditFT;
FixedText* m_pLastEditFT;
FixedText aEditFT;
MultiLineEdit aEditED;
MultiLineEdit* m_pEditED;
FixedText aAuthorFT;
PushButton aAuthorBtn;
VclContainer* m_pInsertAuthor;
PushButton* m_pAuthorBtn;
OKButton aOKBtn;
CancelButton aCancelBtn;
HelpButton aHelpBtn;
OKButton* m_pOKBtn;
ImageButton aPrevBtn;
ImageButton aNextBtn;
PushButton* m_pPrevBtn;
PushButton* m_pNextBtn;
const SfxItemSet& rSet;
SfxItemSet* pOutSet;
......
This diff is collapsed.
......@@ -111,7 +111,6 @@
#define RID_SVX_GRFFILTER_DLG_SMOOTH (RID_SVX_START + 337)
#define RID_SVXDLG_SEARCHFORMAT (RID_SVX_START + 21)
#define RID_SVXDLG_CHARMAP ( RID_SVX_START + 10 )
#define RID_SVXDLG_POSTIT ( RID_SVX_START + 8 )
// IDs of options pages of applications
#define RID_SW_TP_MAILCONFIG (RID_OFA_START + 102)
......
......@@ -465,7 +465,7 @@ public:
virtual VclAbstractDialog* CreateSvxScriptOrgDialog( Window* pParent, const String& rLanguage ) = 0;
virtual CreateSvxDistributePage GetSvxDistributePageCreatorFunc() = 0; // add for SvxDistributePage
virtual DialogGetRanges GetDialogGetRangesFunc( sal_uInt16 nId ) = 0; //add for SvxPostItDialog
virtual DialogGetRanges GetDialogGetRangesFunc() = 0; //add for SvxPostItDialog
virtual AbstractScriptSelectorDialog*
CreateScriptSelectorDialog(
......
......@@ -1061,7 +1061,7 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl)
rtl::OUString sComment = convertLineEnd(rRedline.GetComment(), GetSystemLineEnd());
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "Dialogdiet fail!");
::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc( RID_SVXDLG_POSTIT );
::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc();
OSL_ENSURE(fnGetRange, "Dialogdiet fail! GetRanges()");
SfxItemSet aSet( pSh->GetAttrPool(), fnGetRange() );
......
......@@ -408,7 +408,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "Dialogdiet fail!");
::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc( RID_SVXDLG_POSTIT );
::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc();
OSL_ENSURE(fnGetRange, "Dialogdiet fail! GetRanges()");
SfxItemSet aSet(GetPool(), fnGetRange());
aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment