Re: Close Page Preview from Code

2015-12-18 Thread Regina Henschel

Hi Tengiz,

Tengiz Merabishvili schrieb:

Hello, I have a small question about working with documents.

Is there a function that allows me to check if the document I am currently
working on is in Page Preview state, or a function that lets me 'Close
Preview' for that document?

I searched XModel and XController classes but was unable to find anything
like that.



You can use the dispatcher and the slots ".uno:PrintPreview" and 
".uno:ClosePreview" as recorded.


for example:
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:PrintPreview", "", 0, Array())

Kind regards
Regina



-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org



Re: Close Page Preview from Code

2015-12-18 Thread Regina Henschel

Hi Tengiz,

I can only tell you how to do it in Basic, and there it is exactly as I 
have posted. Which language do you want to use?


Kind regards
Regina

Tengiz Merabishvili schrieb:

Hello Regina,

Thanks a lot for your reply.

I am having trouble creating a Uno service.
This is what I am trying to do:
XDispatch dispatcher =
createUnoService("com.sun.star.frame.DispatchHelper");

But I get "cannot find symbol" error for createUnoService and do not know
which package it is included in.

Could you help me with that?

Thanks,

Best Regards,

Tengiz Merabishvili

FINA Ltd |   ORACLE   Gold Partner

On Fri, Dec 18, 2015 at 12:41 PM, Regina Henschel 
wrote:


Hi Tengiz,

Tengiz Merabishvili schrieb:


Hello, I have a small question about working with documents.

Is there a function that allows me to check if the document I am currently
working on is in Page Preview state, or a function that lets me 'Close
Preview' for that document?

I searched XModel and XController classes but was unable to find anything
like that.



You can use the dispatcher and the slots ".uno:PrintPreview" and
".uno:ClosePreview" as recorded.

for example:
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:PrintPreview", "", 0, Array())

Kind regards
Regina



-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org







-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org



Re: Close Page Preview from Code

2015-12-18 Thread Tengiz Merabishvili
Hello Regina,

I am using Java, trying it like that:
PropertyValue[] args = new PropertyValue[3];

args[0] = new PropertyValue();
args[0].Name = "DocName";
args[0].Value =
getTitlePropertyValue(getXDesktop().getCurrentComponent());
args[1] = new PropertyValue();
args[1].Name = "Index";
args[1].Value = 1;
args[2] = new PropertyValue();
args[2].Name = "Copy";
args[2].Value = true;

XDispatchProvider xTempDispatchProvider =
unoQuery(XDispatchProvider.class, xTempNewDocumentController.getFrame());
getXDispatchHelper().executeDispatch(xTempDispatchProvider,
".uno:ClosePreview", "", 0, args);

But the executeDispatch call doesn't seem to be working correctly.

Thanks,


Re: Close Page Preview from Code

2015-12-18 Thread Tengiz Merabishvili
Hello Regina,

Thanks a lot for your reply.

I am having trouble creating a Uno service.
This is what I am trying to do:
XDispatch dispatcher =
createUnoService("com.sun.star.frame.DispatchHelper");

But I get "cannot find symbol" error for createUnoService and do not know
which package it is included in.

Could you help me with that?

Thanks,

Best Regards,

Tengiz Merabishvili

FINA Ltd |   ORACLE   Gold Partner

On Fri, Dec 18, 2015 at 12:41 PM, Regina Henschel 
wrote:

> Hi Tengiz,
>
> Tengiz Merabishvili schrieb:
>
>> Hello, I have a small question about working with documents.
>>
>> Is there a function that allows me to check if the document I am currently
>> working on is in Page Preview state, or a function that lets me 'Close
>> Preview' for that document?
>>
>> I searched XModel and XController classes but was unable to find anything
>> like that.
>>
>>
> You can use the dispatcher and the slots ".uno:PrintPreview" and
> ".uno:ClosePreview" as recorded.
>
> for example:
> document   = ThisComponent.CurrentController.Frame
> dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
> dispatcher.executeDispatch(document, ".uno:PrintPreview", "", 0, Array())
>
> Kind regards
> Regina
>
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
> For additional commands, e-mail: dev-h...@openoffice.apache.org
>
>


Re: Close Page Preview from Code

2015-12-18 Thread Regina Henschel

Hi Tengiz,

Tengiz Merabishvili schrieb:

Hello Regina,

I am using Java,


then someone else should help you. Perhaps you can ask in the forum? 
Using the dispatcher is nothing special.


Or have you already searched for dispatcher in the developer guide? Most 
examples are in Java there.


 trying it like that:

PropertyValue[] args = new PropertyValue[3];

 args[0] = new PropertyValue();
 args[0].Name = "DocName";
 args[0].Value =
getTitlePropertyValue(getXDesktop().getCurrentComponent());
 args[1] = new PropertyValue();
 args[1].Name = "Index";
 args[1].Value = 1;
 args[2] = new PropertyValue();
 args[2].Name = "Copy";
 args[2].Value = true;

 XDispatchProvider xTempDispatchProvider =
unoQuery(XDispatchProvider.class, xTempNewDocumentController.getFrame());
 getXDispatchHelper().executeDispatch(xTempDispatchProvider,
".uno:ClosePreview", "", 0, args);

But the executeDispatch call doesn't seem to be working correctly.


In Basic "args" is an empty array in case of ".uno:ClosePreview".

Kind regards
Regina

-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org



Re: Close Page Preview from Code

2015-12-18 Thread Tengiz Merabishvili
Hello Regina,

Everything works now, thanks a lot for your help.

This is the final code in case anyone has the same problem:

PropertyValue[] args = new PropertyValue[0];

XDispatchProvider xTempDispatchProvider = unoQuery(XDispatchProvider.class,
xTempNewDocumentController.getFrame());
getXDispatchHelper().executeDispatch(xTempDispatchProvider,
".uno:ClosePreview", "", 0, args);

Thanks,

Best Regards,

Tengiz Merabishvili

FINA Ltd |   ORACLE   Gold Partner

On Fri, Dec 18, 2015 at 3:20 PM, Regina Henschel 
wrote:

> Hi Tengiz,
>
> Tengiz Merabishvili schrieb:
>
>> Hello Regina,
>>
>> I am using Java,
>>
>
> then someone else should help you. Perhaps you can ask in the forum? Using
> the dispatcher is nothing special.
>
> Or have you already searched for dispatcher in the developer guide? Most
> examples are in Java there.
>
>  trying it like that:
>
>> PropertyValue[] args = new PropertyValue[3];
>>
>>  args[0] = new PropertyValue();
>>  args[0].Name = "DocName";
>>  args[0].Value =
>> getTitlePropertyValue(getXDesktop().getCurrentComponent());
>>  args[1] = new PropertyValue();
>>  args[1].Name = "Index";
>>  args[1].Value = 1;
>>  args[2] = new PropertyValue();
>>  args[2].Name = "Copy";
>>  args[2].Value = true;
>>
>>  XDispatchProvider xTempDispatchProvider =
>> unoQuery(XDispatchProvider.class, xTempNewDocumentController.getFrame());
>>
>>  getXDispatchHelper().executeDispatch(xTempDispatchProvider,
>> ".uno:ClosePreview", "", 0, args);
>>
>> But the executeDispatch call doesn't seem to be working correctly.
>>
>
> In Basic "args" is an empty array in case of ".uno:ClosePreview".
>
>
> Kind regards
> Regina
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
> For additional commands, e-mail: dev-h...@openoffice.apache.org
>
>