Need some direction / Guidance

Miklos Vajna vmiklos at suse.cz
Wed Sep 19 01:21:47 PDT 2012


Hi Sagar,

[ CC'ing the dev list, that's the place to ask question like this. ]

On Wed, Sep 19, 2012 at 08:48:34AM +0300, Sagar Srivastava <sagar.libo at gmail.com> wrote:
> In the following file :
> 
> *filter/source/pdf/impdialog.cxx*
> 
> Check out the piece of code inside the following method :
> 
> *ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent,
>                                             const SfxItemSet& rCoreSet
>                                             ) :
>     SfxTabPage( pParent, PDFFilterResId( RID_PDF_TAB_GENER ), rCoreSet ),
> 
>     maFlPages( this, PDFFilterResId( FL_PAGES ) ),
>     maRbAll( this, PDFFilterResId( RB_ALL ) ),
>     maRbRange( this, PDFFilterResId( RB_RANGE ) ),
>     maRbSelection( this, PDFFilterResId( RB_SELECTION ) ),
>     maEdPages( this, PDFFilterResId( ED_PAGES ) ),*
> 
> Requirement :
> 
> I want to change the macro "*RB_RANGE*" to another e.g. *RB_RANGE_IMPRESS*
> at runtime, if the source document is a presentation document implying
> "*if (mbIsPresentation)*".
> 
> Any Idea for it ???
> 
> I didn't find any mechanism to change the macro at runtime yet.

Not exactly sure what you mean, but in general, if you want to make the
initialization of a member conditional, then do it inside the
constructor body -- something like:

ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent, const SfxItemSet& rCoreSet )
    : <normal init here>
{
    if (mbIsPresentation)
        maRbRange = Radiobutton( this, PDFFilterResId( RB_RANGE_IMPRESS ) )
    else
        maRbRange = Radiobutton( this, PDFFilterResId( RB_RANGE ) )
}

Or you can avoid the double-initialization with adding a setResId()
method, so the resource id can be set later, after the ctor is already
called.

Miklos


More information about the LibreOffice mailing list